UNPKG

@n1k1t/mock-server

Version:

Powerful util to setup mocks over HTTP APIs

27 lines 1.82 kB
import { ExpectationOperator } from '../models/operator'; import { TFunction } from '../../../types'; import { CompileExpectationOperatorValue, IExpectationSchemaContext, IExpectationExecUtils, IExpectationOperatorsSchema, TExpectationMetaTag, TExpectationOperatorLocation } from '../types'; export default class SwitchExpectationOperator<TContext extends IExpectationSchemaContext, TPickLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TPickValue = void, TForwardLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TForwardValue = void> extends ExpectationOperator<TContext, { [K in TPickLocation]: { $location: K; $cases: Partial<Record<Extract<CompileExpectationOperatorValue<TContext, K, TPickValue>, number | string> extends never ? (number | string) : Extract<CompileExpectationOperatorValue<TContext, K, TPickValue>, number | string>, IExpectationOperatorsSchema<TContext, TForwardLocation, TForwardValue>>>; $default?: IExpectationOperatorsSchema<TContext, TForwardLocation, TForwardValue>; $path?: string; $exec?: string | TFunction<unknown, [ CompileExpectationOperatorValue<TContext, K, TPickValue>, IExpectationExecUtils<TContext> ]>; }; }[TPickLocation]> { compiled: { exec?: ((mode: import("../types").IExpectationExecMode, context: TContext, ...args: unknown[]) => any) | undefined; default?: ExpectationOperator<TContext, any> | null | undefined; cases: Record<string | number, ExpectationOperator<any, any>>; }; get tags(): TExpectationMetaTag[]; match(context: TContext): boolean; manipulate<T extends TContext>(context: T): T; private handle; private extractValue; } //# sourceMappingURL=switch.operator.d.ts.map