How to use the expect.default.spyOn 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 tomchentw-deprecated / redux-component / src / components / __tests__ / Componentize.spec.js View on Github external
const spies = Object.keys(lifecycleCallbacks).reduce((acc, key) => {
          /* eslint-disable no-param-reassign */
          acc[key] = expect.spyOn(lifecycleCallbacks, key);
          /* eslint-enable no-param-reassign */
          return acc;
        }, {});
github tomchentw / react-google-maps / src / __tests__ / GoogleMap.spec.js View on Github external
it(`should call setZoom when props.zoom changes`, () => {
      const setZoomSpy = expect.spyOn(maps.Map.prototype, `setZoom`);
      expect(setZoomSpy).toNotHaveBeenCalled();

      render((
        
      ), domEl);
      expect(setZoomSpy).toNotHaveBeenCalled();

      render((
        
      ), domEl);
      expect(setZoomSpy).toHaveBeenCalled();

      setZoomSpy.restore();
    });
  });
github tomchentw / react-google-maps / src / __tests__ / GoogleMap.spec.js View on Github external
it(`should call constructor during initial render`, () => {
      const constructorSpy = expect.spyOn(maps, `Map`);
      expect(constructorSpy).toNotHaveBeenCalled();

      render((
        
      ), domEl);

      expect(constructorSpy).toHaveBeenCalled();

      constructorSpy.restore();
    });
github tomchentw / react-google-maps / src / __tests__ / GoogleMap.spec.js View on Github external
it(`should warn and throw error`, () => {
        const warningSpy = expect.spyOn(console, `error`);
        expect(warningSpy).toNotHaveBeenCalled();

        let error;
        try {
          render((
            
          ), document.createElement(`div`));
        } catch (__e__) {
          error = __e__;
        }
        expect(error).toExist();
        expect(warningSpy).toHaveBeenCalled();

        warningSpy.restore();
      });
    });
github tomchentw / react-google-maps / src / utils / __tests__ / index.spec.js View on Github external
it(`should call google.maps.event.trigger`, (done) => {
        const triggerSpy = expect.spyOn(maps.event, `trigger`);
        expect(triggerSpy).toNotHaveBeenCalled();

        function ref(component) {
          triggerEvent(component, `resize`);
          expect(triggerSpy).toHaveBeenCalled();

          triggerSpy.restore();
          done();
        }

        render((
          }
            googleMapElement={}
          />
        ), document.createElement(`div`));

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