strong-mock
Version:
Type safe mocking library for TypeScript
27 lines (26 loc) • 1.3 kB
TypeScript
import type { Expectation } from '../expectation/expectation';
import type { ReturnValue } from '../expectation/repository/return-value';
import type { ConcreteMatcher } from '../mock/options';
import type { Property } from '../proxy';
/**
* An expectation has to be built incrementally, starting first with the property
* being accessed inside {@link createStub}, then any arguments passed to it, and ending
* it with the returned value from {@link createReturns}.
*/
export interface ExpectationBuilder {
setProperty: (prop: Property) => void;
setArgs: (args: unknown[] | undefined) => void;
finish: (returnValue: ReturnValue) => Expectation;
}
export type ExpectationFactory = (property: Property, args: any[] | undefined, returnValue: ReturnValue, concreteMatcher: ConcreteMatcher, exactParams: boolean) => Expectation;
export declare class ExpectationBuilderWithFactory implements ExpectationBuilder {
private createExpectation;
private concreteMatcher;
private exactParams;
private args;
private property;
constructor(createExpectation: ExpectationFactory, concreteMatcher: ConcreteMatcher, exactParams: boolean);
setProperty(value: Property): void;
setArgs(value: unknown[] | undefined): void;
finish(returnValue: ReturnValue): Expectation;
}