@augment-vir/test
Version:
A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner.
50 lines (49 loc) • 1.42 kB
TypeScript
import { type AnyFunction } from '@augment-vir/core';
import { type FunctionTestCase } from './it-cases.js';
/**
* 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.
*
* @category Test
* @category Package : @augment-vir/test
* @example
*
* ```ts
* 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,
* ],
* },
* ]);
* });
* ```
*
* @package [`@augment-vir/test`](https://www.npmjs.com/package/@augment-vir/test)
*/
export declare function snapshotCases<const FunctionToTest extends AnyFunction>(this: void, functionToTest: FunctionToTest, testCases: ReadonlyArray<Omit<FunctionTestCase<NoInfer<FunctionToTest>>, 'expect' | 'throws'>>): void[];