Jest testing patterns — test structure, mocking, async testing, snapshot
99
99%
Does it follow best practices?
Impact
99%
1.26xAverage score across 6 eval scenarios
Passed
No known issues
async service mocking
jest.mock at module level
0%
83%
MockedFunction casting
37%
75%
clearAllMocks in beforeEach
0%
100%
mockResolvedValueOnce usage
0%
100%
toHaveBeenCalledWith verification
100%
100%
toHaveBeenCalledTimes verification
25%
100%
async/await pattern
100%
100%
rejects.toThrow for errors
100%
100%
describe/it structure
100%
100%
it() verb-first descriptions
0%
100%
no .only calls
100%
100%
not mocking subject under test
100%
100%
API route testing with mocks
jest.mock at module level
100%
100%
MockedFunction casting
62%
87%
clearAllMocks in beforeEach
100%
100%
mockResolvedValueOnce usage
0%
100%
expect.assertions usage
0%
100%
rejects.toThrow or error response check
87%
100%
toHaveBeenCalledWith verification
100%
100%
toHaveBeenCalledTimes verification
37%
100%
async/await pattern
100%
100%
describe/it structure
87%
100%
it() verb-first descriptions
100%
100%
no .only calls
100%
100%
Jest TypeScript configuration
ts-jest preset
100%
100%
node testEnvironment
100%
100%
roots points to src
100%
100%
testMatch for .test.ts files
100%
100%
collectCoverageFrom set correctly
100%
100%
test script in package.json
100%
100%
test:watch script in package.json
100%
100%
test:coverage script in package.json
100%
100%
jest.config.ts uses export default
100%
100%
setupFilesAfterFramework referenced
37%
100%
ts-jest and jest devDependencies
100%
100%
jest.setup.ts file created
100%
100%
spyOn and test isolation
jest.spyOn for internal method
100%
100%
spy restoration
0%
100%
clearAllMocks in beforeEach
100%
100%
jest.mock for external dependencies
100%
100%
MockedFunction casting
100%
100%
mockReturnValueOnce or mockResolvedValueOnce
100%
100%
toHaveBeenCalledWith on spy
100%
100%
toHaveBeenCalledTimes on spy
100%
100%
not mocking subject under test
100%
100%
async/await pattern
100%
100%
describe/it structure
100%
100%
no .only calls
100%
100%
useFakeTimers in beforeEach
100%
100%
useRealTimers in afterEach
100%
100%
advanceTimersByTime usage
100%
100%
clearAllMocks in beforeEach
0%
100%
toHaveBeenCalledTimes verification
100%
100%
boundary condition tests
100%
100%
describe/it structure
100%
100%
it() verb-first descriptions
100%
100%
no .only calls
100%
100%
not mocking subject under test
100%
100%