Skip to content

Instantly share code, notes, and snippets.

@theKashey
Last active March 29, 2018 12:16
Show Gist options
  • Save theKashey/1721990a27bd6987609e4765ffcdca8b to your computer and use it in GitHub Desktop.
Save theKashey/1721990a27bd6987609e4765ffcdca8b to your computer and use it in GitHub Desktop.
dooms-day mockery.js
import mockery from 'mockery';
import sinon from 'sinon';
//import {Launch} from './rocket-silo'; // you cannot use imports
//import {theDay} from 'doom-scheduler'
mockery.registerMock('./rocket-silo', {
Launch: sinon.stub()
});
mockery.registerMock('doom-scheduler', {
theDay: Promise.resolve()
});
mockery.enable();
const {Launch} = require('./rocket-silo');
mockery.disable();
expect(Launch).toHaveBeenCalled();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment