Skip to content

Instantly share code, notes, and snippets.

@theKashey
Last active March 29, 2018 21:49
Show Gist options
  • Save theKashey/4d1b73a4256cf4a4bc158cef40dcf570 to your computer and use it in GitHub Desktop.
Save theKashey/4d1b73a4256cf4a4bc158cef40dcf570 to your computer and use it in GitHub Desktop.
Rewiremock proxyquire
import rewiremock from 'rewiremock';
import sinon from 'sinon';
const Launch = sinon.stub()
// const case = proxyquire.load('./dooms-day.js',{
const case = rewiremock.proxy('./dooms-day.js',{
'./rocket-silo': { Launch },
'doom-scheduler': { theDay: Promise.resolve()}
});
expect(Launch).toHaveBeenCalled();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment