Parameterised tests for Jest that enable running the same test multiple times with different data sets using arrays or tagged template literals
85
{
"context": "This criteria evaluates how well an engineer uses Jest's mock function capabilities, specifically jest.fn(), to test callback behavior in an event emitter system. The focus is on proper mock creation, call tracking, and assertion usage.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Mock creation",
"description": "Uses jest.fn() to create mock callback functions for testing event listeners",
"max_score": 20
},
{
"name": "Call verification",
"description": "Uses toHaveBeenCalled() or toHaveBeenCalledTimes() matchers to verify mock functions are invoked the expected number of times",
"max_score": 25
},
{
"name": "Argument verification",
"description": "Uses toHaveBeenCalledWith() matcher to verify mock functions receive the exact expected arguments",
"max_score": 25
},
{
"name": "Negative assertions",
"description": "Uses .not.toHaveBeenCalled() or similar negative assertions to verify removed listeners are not invoked",
"max_score": 20
},
{
"name": "Test completeness",
"description": "Implements all four test cases specified in the requirements with appropriate mock function setup and assertions",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-jest-eachdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10