Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function test_spies() {
// Spy
const spy = expect.createSpy<(a: number) => number>()
expect.isSpy(spy);
const otherSpy = expect.spyOn({}, "test");
expect.restoreSpies();
spy.andCall(() => {});
spy.andCallThrough();
spy.andReturn(1);
spy.andThrow(new Error("test"));
spy.restore();
spy(1);
spy.calls[0].arguments;
spy.calls[0].context;
expect(spy).toBe(spy);
expect(spy).toEqual(spy);
expect(spy).toExist();
resetSpies: () => Object.values(mockCanvasContext).forEach((spy) => {
if (isSpy(spy)) {
spy.reset();
}
}),
};
resetSpies: () => Object.values(mockCanvasContext).forEach((spy) => {
if (isSpy(spy)) {
spy.reset();
}
}),
};