Created
October 2, 2017 22:28
-
-
Save deanbudd/9cf25b587c71f60b5055c16da18744a4 to your computer and use it in GitHub Desktop.
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
const sinon = require('sinon') | |
const componentIWantToMock = { | |
functionIWantToMock: function() {} | |
} | |
const componentThatUsesMock = { | |
someFunction: function(mock) { | |
mock.functionIWantToMock() | |
} | |
} | |
const mockComponent = sinon.mock(componentIWantToMock) | |
mockComponent.expects('functionIWantToMock').once() | |
componentThatUsesMock.someFunction(componentIWantToMock) | |
mockComponent.verify() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment