Parameterised tests for Jest that enable running the same test multiple times with different data sets using arrays or tagged template literals
85
Pending
Does it follow best practices?
Impact
85%
1.10xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
{
"context": "This criteria evaluates how well the engineer uses Jest's module mocking capabilities (jest.mock() and jest.unmock()) to test a notification service by mocking external provider modules. The focus is on proper usage of Jest's module mocking API to isolate dependencies during testing.",
"type": "weighted_checklist",
"checklist": [
{
"name": "jest.mock() usage",
"description": "Uses jest.mock() to mock the email-provider and sms-provider modules in test files. The mocks should be declared at the top level of test files (before any imports or requires of the actual modules being tested).",
"max_score": 25
},
{
"name": "Mock implementations",
"description": "Properly implements mock return values using mockResolvedValue() or mockImplementation() on the mocked provider functions (sendEmail and sendSMS) to simulate both success and failure scenarios.",
"max_score": 20
},
{
"name": "Failure scenario mocking",
"description": "Uses mockRejectedValue() or similar techniques to simulate provider failures, allowing tests to verify error handling behavior when external services fail.",
"max_score": 15
},
{
"name": "Mock verification",
"description": "Uses Jest matchers like toHaveBeenCalled(), toHaveBeenCalledWith(), or toHaveBeenCalledTimes() to verify that the correct provider functions were called with the expected arguments.",
"max_score": 15
},
{
"name": "jest.unmock() usage",
"description": "Uses jest.unmock() to restore real module implementations in tests that verify the service works with actual (non-mocked) provider implementations.",
"max_score": 15
},
{
"name": "Mock cleanup",
"description": "Properly manages mock state between tests using jest.clearAllMocks(), mockClear(), or similar methods in lifecycle hooks (beforeEach/afterEach) to ensure test isolation.",
"max_score": 10
}
]
}docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10