Function snapshotCases

  • Similar to itCases but instead of defining expectation in each test case, each test case is a snapshot test.

    In order to generate or update the snapshot files, run tests in update mode.

    Type Parameters

    Parameters

    Returns void[]

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

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

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