Skip to content

Test method naming (ARCH3008)

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.

describe("UserService", () => {
it("test1", () => {
expect(svc.create(dto)).toBeDefined();
});
it("works", () => {
expect(svc.find(99)).toBeNull();
});
});
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.