strong-mock
Version:
Type safe mocking library for TypeScript
39 lines (38 loc) • 1.34 kB
TypeScript
import { UnexpectedProperty } from '../../mock/options';
import type { Property } from '../../proxy';
import type { Expectation } from '../expectation';
import type { CallMap, ExpectationRepository } from './expectation-repository';
type CountableExpectation = {
expectation: Expectation;
matchCount: number;
};
/**
* An expectation repository with a configurable behavior for
* unexpected property access.
*/
export declare class FlexibleRepository implements ExpectationRepository {
private unexpectedProperty;
constructor(unexpectedProperty?: UnexpectedProperty);
protected readonly expectations: Map<Property, CountableExpectation[]>;
private readonly expectedCallStats;
private readonly unexpectedCallStats;
add(expectation: Expectation): void;
clear(): void;
apply: (args: unknown[]) => unknown;
get(property: Property): any;
private handlePropertyWithMatchingExpectations;
private handlePropertyWithNoExpectations;
getAllProperties(): Property[];
getCallStats(): {
expected: CallMap;
unexpected: CallMap;
};
getUnmet(): Expectation[];
private recordExpected;
private recordUnexpected;
private countAndConsume;
private consumeExpectation;
private getValueForUnexpectedCall;
private getValueForUnexpectedAccess;
}
export {};