Runs the KptFunc and asserts the expected output or error.
Example usage:
const RUNNER = new TestRunner(myFunc);
it('function is a NO OP', async () => {
await RUNNER.assert());
};
input Configs passed to the function. It is deep-copied before running the function. If undefined, assumes an empty Configs.
expected resultant Configs after running the function regardless of success or failure. Use 'unchanged' if the function is not expected to change input Configs.
expected error type to be thrown.
expected message of expection to be thrown.
Similar to assert method, but instead returns an assertion function that can be passed directly to 'it'.
Example usage:
const RUNNER = new TestRunner(myFunc);
it('function is a NO OP', RUNNER.assertCallback());
input Configs passed to the function. It is deep-copied before running the function. If undefined, assumes an empty Configs.
expected resultant Configs after running the function regardless of success or failure. Use 'unchanged' if the function is not expected to change input Configs.
expected error type to be thrown.
expected message of expection to be thrown.
Similar to assert method, but instead returns an assertion function that can be passed directly to 'it'.
Example usage:
const RUNNER = new TestRunner(myFunc);
it('function is a NO OP', RUNNER.assertCallback());
Generated using TypeDoc
TestRunner makes it easy to write unit tests for kpt functions.