Test method naming (ARCH3008)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.naming.test-name-convention · Severity info · Category naming
Test functions should follow the test framework’s discovery and naming convention. Vague or inconsistent names hide the test’s intent and make failure output unreadable.
Incorrect
Section titled “Incorrect”describe("UserService", () => { it("test1", () => { expect(svc.create(dto)).toBeDefined(); });
it("works", () => { expect(svc.find(99)).toBeNull(); });});Correct
Section titled “Correct”describe("UserService", () => { it("creates a user from a valid DTO", () => { expect(svc.create(dto)).toBeDefined(); });
it("returns null when the user is not found", () => { expect(svc.find(99)).toBeNull(); });});Rename the test to a descriptive sentence stating the behavior and expected outcome.