Last active
March 29, 2018 21:55
-
-
Save theKashey/afaddfb7b75bd4968226648223b925c6 to your computer and use it in GitHub Desktop.
Rewiremock mockery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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