foundation-testing.createlogicsuite
Home > @genesislcap/foundation-testing > createLogicSuite
createLogicSuite() function
Create logic test suite.
Signature:
export declare function createLogicSuite<TContext = LogicContext>(title: string, context?: TContext): uvu.Test<TContext>;
Parameters
Parameter | Type | Description |
---|---|---|
title | string | Title of the test suite |
context | TContext | (Optional) Optional context which extends LogicContext |
Returns:
uvu.Test<TContext>
The test suite
Remarks
Used to test function output given certain input arguments.
Example
import { createLogicSuite } from '@genesislcap/foundation-testing';
import { myFunction } from './logic';
const Suite = createLogicSuite('myFunction');
Suite('myFunction should provide expected results', ({ runCases }) => {
runCases(myFunction, [
[['1'], true],
[[123], true],
[['60%'], true],
[['$60'], false],
[['1.1'], false],
[[''], false],
[[true], false],
[[null], false],
[[undefined], false],
]);
});
Suite.run();