How to use the expect.restoreSpies function in expect

To help you get started, we’ve selected a few expect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goblindegook / dictionary-react-redux-typescript / test / typings / expect.spec.ts View on Github external
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();
github parsable / react-truncate-markup / __tests__ / browser.js View on Github external
afterEach(() => {
    document.documentElement.removeChild(div);

    expect.restoreSpies();
  });
github galkinrost / react-adaptive-grid / test / Display.spec.js View on Github external
afterEach(() => {
            ReactDOM.unmountComponentAtNode(mountNode)
            expect.restoreSpies()
        })
github Kitware / HPCCloud / test / redux / clusters.js View on Github external
afterEach(() => {
      expect.restoreSpies();
    });
github Kitware / HPCCloud / test / redux / fs.js View on Github external
afterEach(() => {
      expect.restoreSpies();
    });

expect

This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

MIT
Latest version published 8 months ago

Package Health Score

93 / 100
Full package analysis