Pattern: Duplicate test title
Issue: -
Using identical titles for different tests or test suites at the same level creates confusion when tests fail and makes it harder to identify which test needs fixing.
Example of incorrect code:
describe("suite", () => {
it("should work", () => {
expect(a).toBe(true);
});
it("should work", () => {
expect(b).toBe(true);
});
});
describe("feature", () => {});
describe("feature", () => {});
Example of correct code:
describe("suite", () => {
it("should work with A", () => {
expect(a).toBe(true);
});
it("should work with B", () => {
expect(b).toBe(true);
});
});
describe("feature A", () => {});
describe("feature B", () => {});