Last active
August 15, 2019 21:51
-
-
Save fabriciofmsilva/42b0e28081ba6f191fe160e8d2aff1a8 to your computer and use it in GitHub Desktop.
Moment Mock
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 { fn as momentProto } from 'moment'; | |
const MOCK_TODAY = '2019-08-14'; | |
const sandbox = sinon.sandbox.create(); | |
before(() => { | |
sandbox.stub(momentProto, 'toISOString'); | |
momentProto.toISOString.withArgs().returns(MOCK_TODAY); | |
}); | |
after(() => { | |
sandbox.restore(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment