How to use the expect.isSpy 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();
github jplayer / react-jPlayer / src / util / specHelpers / mockData / mockCanvasContext.spec.js View on Github external
resetSpies: () => Object.values(mockCanvasContext).forEach((spy) => {
    if (isSpy(spy)) {
      spy.reset();
    }
  }),
};
github jplayer / react-jPlayer / src / util / common.spec.jsx View on Github external
resetSpies: () => Object.values(mockCanvasContext).forEach((spy) => {
    if (isSpy(spy)) {
      spy.reset();
    }
  }),
};

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 1 year ago

Package Health Score

88 / 100
Full package analysis