|
|
@ -1,35 +1,27 @@ |
|
|
|
import { |
|
|
|
import { |
|
|
|
InputTest, |
|
|
|
InputTest, |
|
|
|
|
|
|
|
InputTestBatches, |
|
|
|
|
|
|
|
InputTestInputs, |
|
|
|
TestInputFunction, |
|
|
|
TestInputFunction, |
|
|
|
TestInputFunctionOptions, |
|
|
|
|
|
|
|
} from '../../types/TestInputFunction'; |
|
|
|
} from '../../types/TestInputFunction'; |
|
|
|
|
|
|
|
|
|
|
|
const testInput: TestInputFunction = ({ |
|
|
|
const testInput: TestInputFunction = ({ |
|
|
|
|
|
|
|
excludeTestIds = [], |
|
|
|
inputs, |
|
|
|
inputs, |
|
|
|
isContinueOnFailure, |
|
|
|
isContinueOnFailure, |
|
|
|
isIgnoreOnCallbacks, |
|
|
|
isIgnoreOnCallbacks, |
|
|
|
tests = {}, |
|
|
|
tests = {}, |
|
|
|
} = {}): boolean => { |
|
|
|
} = {}): boolean => { |
|
|
|
const testsToRun = |
|
|
|
let testsToRun: Readonly<InputTestInputs> = |
|
|
|
inputs ?? |
|
|
|
inputs ?? |
|
|
|
Object.keys(tests).reduce< |
|
|
|
Object.keys(tests).reduce<InputTestInputs>((previous, id: string) => { |
|
|
|
Exclude<TestInputFunctionOptions['inputs'], undefined> |
|
|
|
previous[id] = {}; |
|
|
|
>((reduceContainer, id: string) => { |
|
|
|
return previous; |
|
|
|
reduceContainer[id] = {}; |
|
|
|
|
|
|
|
return reduceContainer; |
|
|
|
|
|
|
|
}, {}); |
|
|
|
}, {}); |
|
|
|
|
|
|
|
|
|
|
|
let allResult = true; |
|
|
|
let allResult = true; |
|
|
|
|
|
|
|
|
|
|
|
let setBatchCallback: ( |
|
|
|
let setBatchCallback: (batch?: Partial<InputTestBatches[string]>) => { |
|
|
|
batch?: Partial< |
|
|
|
cbFinishBatch: InputTestBatches[string]['onFinishBatch']; |
|
|
|
Exclude<TestInputFunctionOptions['tests'], undefined>[string] |
|
|
|
|
|
|
|
>, |
|
|
|
|
|
|
|
) => { |
|
|
|
|
|
|
|
cbFinishBatch: Exclude< |
|
|
|
|
|
|
|
TestInputFunctionOptions['tests'], |
|
|
|
|
|
|
|
undefined |
|
|
|
|
|
|
|
>[string]['onFinishBatch']; |
|
|
|
|
|
|
|
} = () => ({ cbFinishBatch: undefined }); |
|
|
|
} = () => ({ cbFinishBatch: undefined }); |
|
|
|
let setSingleCallback: (test?: Partial<InputTest>) => { |
|
|
|
let setSingleCallback: (test?: Partial<InputTest>) => { |
|
|
|
cbFailure: InputTest['onFailure']; |
|
|
|
cbFailure: InputTest['onFailure']; |
|
|
@ -46,6 +38,14 @@ const testInput: TestInputFunction = ({ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testsToRun = excludeTestIds.reduce<InputTestInputs>( |
|
|
|
|
|
|
|
(previous, id: string) => { |
|
|
|
|
|
|
|
delete previous[id]; |
|
|
|
|
|
|
|
return previous; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ ...testsToRun }, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
Object.keys(testsToRun).every((id: string) => { |
|
|
|
Object.keys(testsToRun).every((id: string) => { |
|
|
|
const { |
|
|
|
const { |
|
|
|
defaults: { |
|
|
|
defaults: { |
|
|
|