Skip to content

repeated-static-call-cases

Review three or more consecutive static-input call assertions as potential named cases.

Why

Copy-pasted cases obscure the input table, and a thrown assertion can stop later cases from being reported.

Fix

If the calls are independent, use the runner's named parameterized cases or subtests. Preserve ordered state-transition scenarios as one test.

Examples

Before — flagged Do not repeat literal cases
src/parser.test.ts
test("parses", () => {
expect(parse("a")).toBe(true);
expect(parse("b")).toBe(false);
expect(parse("c")).toBe(true);
});
After — preferred Name each case
src/parser.test.ts
test.each([
["a", true],
["b", false],
["c", true],
])("parses %s", (input, expected) => {
expect(parse(input)).toBe(expected);
});

Files

**/*.test.***/*.spec.***/tests/****/__tests__/**