Skip to content

Instantly share code, notes, and snippets.

@burgwyn
Last active October 16, 2017 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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