Home > @wixc3/testing > waitForSpyCall
Spies on an object method, waiting until it’s called. The spy is removed once called
Signature:
export declare function waitForSpyCall<S extends object>(scope: S, method: keyof S | S[keyof S]): PromiseWithTimeout<any[]>;
Parameter | Type | Description |
---|---|---|
scope | S | |
method | keyof S \| S\[keyof S\] |
Returns:
PromiseWithTimeout<any[]>
const call = waitForSpyCall(target, 'method');
target.method(1, 'success');
expect(await call).to.eql([1, 'success']);