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();
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith();
after(function () {
expect.restoreSpies()
})
afterEach(() => {
document.documentElement.removeChild(div);
expect.restoreSpies();
});
afterEach(() => {
ReactDOM.unmountComponentAtNode(mountNode)
expect.restoreSpies()
})
afterEach(() => {
expect.restoreSpies();
});
afterEach(() => {
expect.restoreSpies();
});
afterEach(() => {
expect.restoreSpies();
});
afterEach(() => {
expect.restoreSpies();
});
});