mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-27 07:14:56 +00:00
678 B
678 B
Write Parameterized Tests
Run tests from frontends/nextjs/.
Add tests using the parameterized it.each() pattern:
import { describe, it, expect } from 'vitest'
describe('myFunction', () => {
it.each([
{ input: 'case1', expected: 'result1' },
{ input: 'case2', expected: 'result2' },
{ input: 'edge-case', expected: 'handled' },
])('should handle $input', ({ input, expected }) => {
expect(myFunction(input)).toBe(expected)
})
})
Place test files next to source: utils.ts → utils.test.ts
Run tests:
npm test- Watch modenpm run test:unit- Single runnpm run test:coverage:report- Generate coverage markdown