Skip to content

Instantly share code, notes, and snippets.

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