MockTypedView interface

Namespace @runic-artifex/views/mock · @runic-artifex/views 0.7.0-preview.5

interface MockTypedView<TState, TClient, TKind extends string = string>

The typed mock of one generated client, created by a generated mock{Name}().

Properties

route

readonly route: string;

The route prefix, such as editor for a root View or content1 for content.

reference

readonly reference: MockReference<TKind>;

Put this in a parent mock's state to present this View as content.

state

readonly state: TState;

No documentation.

revision

readonly revision: number;

No documentation.

raw

readonly raw: MockView;

The untyped mock View, for raw frames.

calls

readonly calls: readonly MockCall[];

Calls to this View's routes, in order.

Methods

update

update(patch: Patch<TState> | ((state: TState) => Patch<TState>)): void;

Merges state changes and pushes the new state, like a .NET publication.

failNext

failNext<M extends MockMethodName<TClient>>(method: M, failure: MockErrorFailure | MockDomainFailure<MockFailureOf<TClient[M]>>, times?: number): void;

Answers the next times calls of a client method with failure: an unexpected failure, or the method's declared failure as { kind: "domain-failed", failure }.

pushFailure

pushFailure(failure: {
    readonly kind?: BridgeErrorKind;
    readonly message: string;
    readonly detail?: BridgeFailureDetail;
}): void;

Pushes a failure notice; the client keeps its last state and reports the error.

batch

batch(edit: () => void): void;

Pushes the collection edits made by edit as one delta frame.