CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/jest-testing

Jest testing patterns — test structure, mocking, async testing, snapshot

99

1.26x
Quality

99%

Does it follow best practices?

Impact

99%

1.26x

Average score across 6 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-1/

{
  "context": "The agent must write Jest tests in TypeScript for an async notification service that depends on an external email client and a user repository. The tests should demonstrate correct module mocking, mock isolation, and async assertion patterns.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "jest.mock at module level",
      "description": "Agent uses jest.mock() at the top/module level to mock external dependencies (email client and user repository), not manual object injection or constructor injection.",
      "max_score": 12
    },
    {
      "name": "MockedFunction casting",
      "description": "Agent casts mocked functions using 'as jest.MockedFunction<typeof fn>' for type-safe mock access in TypeScript.",
      "max_score": 8
    },
    {
      "name": "clearAllMocks in beforeEach",
      "description": "Agent calls jest.clearAllMocks() inside beforeEach (not afterEach) at the top-level describe block.",
      "max_score": 10
    },
    {
      "name": "mockResolvedValueOnce usage",
      "description": "Agent uses mockResolvedValueOnce (not the persistent mockResolvedValue) for per-test async mock setup.",
      "max_score": 10
    },
    {
      "name": "toHaveBeenCalledWith verification",
      "description": "Agent uses toHaveBeenCalledWith to verify the arguments passed to critical mocked functions.",
      "max_score": 8
    },
    {
      "name": "toHaveBeenCalledTimes verification",
      "description": "Agent uses toHaveBeenCalledTimes to verify the number of calls on critical mocked functions (alongside toHaveBeenCalledWith).",
      "max_score": 8
    },
    {
      "name": "async/await pattern",
      "description": "Agent uses async/await syntax in async test functions rather than .then() chaining or done callbacks.",
      "max_score": 8
    },
    {
      "name": "rejects.toThrow for errors",
      "description": "Agent uses 'await expect(fn()).rejects.toThrow(...)' to test rejected promises, not try/catch blocks.",
      "max_score": 10
    },
    {
      "name": "describe/it structure",
      "description": "Agent uses one top-level describe per class/module with nested describe blocks per method.",
      "max_score": 8
    },
    {
      "name": "it() verb-first descriptions",
      "description": "All it() description strings start with a verb (e.g., 'sends', 'throws', 'returns') rather than 'should ...'.",
      "max_score": 8
    },
    {
      "name": "no .only calls",
      "description": "No test.only, it.only, or describe.only appears in the test file.",
      "max_score": 5
    },
    {
      "name": "not mocking subject under test",
      "description": "Agent does not mock the notification service itself — only its external dependencies (email client, user repository) are mocked.",
      "max_score": 5
    }
  ]
}

evals

scenario-1

criteria.json

task.md

tile.json