augment-vir - v31.13.0
    Preparing search index...

    Function snapshotCasesWithContext

    • Same as snapshotCases but passes the test context as the first parameter to the function under test.

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

      Type Parameters

      Parameters

      Returns void[]

      import {
      snapshotCasesWithContext,
      RuntimeEnv,
      describe,
      UniversalTestContext,
      assertTestContext,
      } from '@augment-vir/test';

      function myFunctionToTest(testContext: UniversalTestContext, a: number, b: number) {
      assertTestContext(testContext, RuntimeEnv.Node);
      return testContext.name;
      }

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