Example of unit test using Sinon
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