Last active
October 16, 2017 19:10
-
-
Save burgwyn/e539e86390b0a35870b1f4c1842786f0 to your computer and use it in GitHub Desktop.
Example of unit test using Sinon
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
describe('BidListButtonComponent', () => { | |
const bidList = [{ position: { id: 1 } }]; | |
const bidListFalse = [{ position: { id: 2 } }]; | |
it('can call the toggleSaved function', () => { | |
const spy = sinon.spy(); | |
const wrapper = shallow( | |
<BidListButton | |
id={1} | |
toggleBidPosition={spy} | |
compareArray={bidListFalse} | |
isLoading={false} | |
/>, | |
); | |
wrapper.find('button').simulate('click'); | |
sinon.assert.calledOnce(spy); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment