UNPKG

@chainsafe/eth2.0-spec-test-util

Version:

Spec test suite generator from yaml test files

38 lines (37 loc) 1.28 kB
import { AnySSZType } from "@chainsafe/ssz"; export declare enum InputType { SSZ = "ssz", YAML = "yaml" } export interface ISpecTestOptions<TestCase, Result> { /** * If directory contains both ssz or yaml file version, * you can choose which one to use. Default is ssz. */ inputTypes?: { [K in keyof NonNullable<TestCase>]?: InputType; }; sszTypes?: { [K in keyof NonNullable<TestCase>]?: AnySSZType; }; /** * Optionally * @param testCase */ getExpected?: (testCase: TestCase) => Result; /** * Optionally pass function to transform loaded values * (values from input files) */ inputProcessing?: { [K: string]: (value: any) => any; }; shouldError?: (testCase: TestCase) => boolean; shouldSkip?: (testCase: TestCase, name: string, index: number) => boolean; expectFunc?: (testCase: TestCase, expected: any, actual: any) => void; timeout?: number; } export interface ITestCaseMeta { directoryName: string; } export declare function describeDirectorySpecTest<TestCase, Result>(name: string, testCaseDirectoryPath: string, testFunction: (testCase: TestCase, directoryName: string) => Result, options: Partial<ISpecTestOptions<TestCase, Result>>): void;