mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
add sinon; add basic Button component test
This commit is contained in:
parent
998f161e1d
commit
e0a4455622
2 changed files with 16 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
|||
"redux": "^3.5.2",
|
||||
"redux-immutable": "^3.0.8",
|
||||
"redux-thunk": "^2.1.0",
|
||||
"reselect": "^2.5.4"
|
||||
"reselect": "^2.5.4",
|
||||
"sinon": "^1.17.6"
|
||||
}
|
||||
}
|
||||
|
|
14
spec/javascript/components/button.test.jsx
Normal file
14
spec/javascript/components/button.test.jsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { expect } from 'chai';
|
||||
import { shallow } from 'enzyme';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import Button from '../../../app/assets/javascripts/components/components/button'
|
||||
|
||||
describe('<Button />', function() {
|
||||
it('simulates click events', function() {
|
||||
const onClick = sinon.spy();
|
||||
const wrapper = shallow(<Button onClick={onClick} />);
|
||||
wrapper.find('button').simulate('click');
|
||||
expect(onClick.calledOnce).to.equal(true);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue