Skip to content

Instantly share code, notes, and snippets.

@burgwyn
Last active October 16, 2017 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burgwyn/e539e86390b0a35870b1f4c1842786f0 to your computer and use it in GitHub Desktop.
Save burgwyn/e539e86390b0a35870b1f4c1842786f0 to your computer and use it in GitHub Desktop.
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