Function itCases

Succinctly run many input / output tests for a pure function without repeating it boilerplate. Compatible with both Node.js's test runner and web-test-runner or other Mocha-style test runners.

import {itCases, describe} from '@augment-vir/test';

function myFunctionToTest(a: number, b: number) {
return a + b;
}

describe(myFunctionToTest.name, () => {
itCases(myFunctionToTest, [
{
it: 'handles negative numbers',
inputs: [
-1,
-2,
],
expect: -3,
},
{
it: 'handles 0',
inputs: [
0,
0,
],
expect: 0,
},
{
it: 'adds',
inputs: [
3,
5,
],
expect: 8,
},
]);
});