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 the engineer uses Jest's snapshot property matchers to test objects with dynamic fields. It focuses on proper usage of toMatchSnapshot() with property matchers and asymmetric matchers like expect.any().",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses toMatchSnapshot",
"description": "Tests use toMatchSnapshot() method to validate profile objects against snapshots",
"max_score": 15
},
{
"name": "Property matcher object",
"description": "Passes a property matcher object as the first argument to toMatchSnapshot() to handle dynamic fields",
"max_score": 20
},
{
"name": "expect.any() matchers",
"description": "Uses expect.any(Date), expect.any(String), and expect.any(Number) to match dynamic field types",
"max_score": 25
},
{
"name": "Simple property matching",
"description": "Correctly applies property matchers to top-level dynamic fields (createdAt, userId, sessionToken) in the basic profile tests",
"max_score": 15
},
{
"name": "Nested property matching",
"description": "Correctly applies property matchers to nested dynamic fields (geocode.latitude, geocode.longitude, preferences.lastModified) using object structure that mirrors the data",
"max_score": 20
},
{
"name": "Test coverage",
"description": "All four test cases defined in the spec are implemented (two basic profile tests, two nested object tests)",
"max_score": 5
}
]
}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