Skip to content

Files

Latest commit

 

History

History
29 lines (21 loc) · 555 Bytes

expect-expect.md

File metadata and controls

29 lines (21 loc) · 555 Bytes

Pattern: Missing assertion

Issue: -

Description

Each test should include at least one assertion using expect(). Tests without assertions may pass without actually verifying any behavior.

Examples

Example of incorrect code:

it("should be a test", () => {
  console.log("no assertion");
});

test("should assert something", () => {});

Example of correct code:

it("should be a test", () => {
  expect(value).toBeDefined();
});

test("should assert something", () => {
  expect(result).toBe(true);
});