Skip to content

Instantly share code, notes, and snippets.

@burgwyn burgwyn/SinonExample.jsx
Last active Oct 16, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.