clientnode
Version:
upgrade to object orientated rock solid plugins
144 lines (143 loc) • 11.2 kB
TypeScript
import { AnyFunction, FirstParameter, FunctionTestTuple, FunctionTestPromiseTuple, FunctionTestPromiseRejectionTuple, TestMatchers as Matchers, TestSymbol, ThenParameter, UnknownFunction } from './type';
export declare const TEST_DEFINED_SYMBOL: unique symbol;
export declare const TEST_THROW_SYMBOL: unique symbol;
export declare const TEST_UNDEFINED_SYMBOL: unique symbol;
/**
* Tests given result against given expectations. Respects special symbol
* values.
* @param givenResult - Target to compare expectation against.
* @param expected - Expected result.
* @param wrap - Indicates whether to wrap with an expect function call.
* @returns Nothing or a promise resolving to nothing.
*/
export declare const expectExpectedType: <Type = unknown, Result extends Promise<void> | void = void>(givenResult: Matchers<Result> | Result, expected: TestSymbol | Type, wrap?: boolean) => Result;
/**
* Tests each given test set (expected value follows by various list of
* function parameters). It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param functionTestTuple - Additional arrays of test sets to test given
* function again.
*/
export declare const testEach: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestTuple<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestTuple<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestTuple<FunctionType>>): void;
};
/**
* Tests each given test set (expected value follows by various list of
* function parameters). It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param functionTestTuple - Additional arrays of test sets to test given
* function again.
*/
export declare const testEachPromise: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseTuple<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseTuple<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseTuple<FunctionType>>): void;
};
/**
* Tests each given test set (expected value follows by various list of
* function parameters). It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param functionTestTuple - Additional arrays of test sets to test given
* function again.
*/
export declare const testEachPromiseRejection: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseRejectionTuple<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseRejectionTuple<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, ...functionTestTuple: Array<FunctionTestPromiseRejectionTuple<FunctionType>>): void;
};
/**
* Tests each given single parameter against same given expected value. It
* respects function signature to raise compile time errors if given test set
* does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param parameters - Additional first parameters to test given function with.
*/
export declare const testEachSingleParameterAgainstSameExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
};
/**
* Tests each given single parameter against same given expected value. It
* respects function signature to raise compile time errors if given test set
* does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param parameters - Additional first parameters to test given function with.
*/
export declare const testEachSingleParameterAgainstSamePromisedExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...parameters: Array<FirstParameter<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...parameters: Array<FirstParameter<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...parameters: Array<FirstParameter<FunctionType>>): void;
};
/**
* Tests each given single parameter against same given expected value. It
* respects function signature to raise compile time errors if given test set
* does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param parameters - Additional first parameters to test given function with.
*/
export declare const testEachSingleParameterAgainstSameRejectedExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...parameters: Array<FirstParameter<FunctionType>>): void;
};
/**
* Tests each given test set (various list of function parameters) against same
* given expected value. It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param functionParameters - Additional lists of parameters to test given
* function again.
*/
export declare const testEachAgainstSameExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: ReturnType<FunctionType> | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
};
/**
* Tests each given test set (various list of function parameters) against same
* given expected value. It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param functionParameters - Additional lists of parameters to test given
* function again.
*/
export declare const testEachPromiseAgainstSameExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...functionParameters: Array<Parameters<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...functionParameters: Array<Parameters<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: TestSymbol | ThenParameter<ReturnType<FunctionType>>, ...functionParameters: Array<Parameters<FunctionType>>): void;
};
/**
* Tests each given test set (various list of function parameters) against same
* given expected value. It respects function signature to raise compile time
* errors if given test set does not match given function signature.
* @param functionName - Function description to test.
* @param callback - Function reference to test.
* @param expected - Value to check each function call return value against.
* @param functionParameters - Additional lists of parameters to test given
* function again.
*/
export declare const testEachPromiseRejectionAgainstSameExpectation: {
<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
only<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
skip<FunctionType extends AnyFunction = UnknownFunction>(functionName: string, callback: FunctionType, expected: Error | TestSymbol, ...functionParameters: Array<Parameters<FunctionType>>): void;
};
export default testEach;