forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-tile-view.test.js
More file actions
29 lines (24 loc) · 919 Bytes
/
github-tile-view.test.js
File metadata and controls
29 lines (24 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import {shallow} from 'enzyme';
import GithubTileView from '../../lib/views/github-tile-view';
import * as reporterProxy from '../../lib/reporter-proxy';
describe('GithubTileView', function() {
let wrapper, clickSpy;
beforeEach(function() {
clickSpy = sinon.spy();
wrapper = shallow(<GithubTileView didClick={clickSpy} />);
});
it('renders github icon and text', function() {
assert.isTrue(wrapper.html().includes('mark-github'));
assert.isTrue(wrapper.text().includes('GitHub'));
});
it('calls props.didClick when clicked', function() {
wrapper.simulate('click');
assert.isTrue(clickSpy.calledOnce);
});
it('records an event on click', function() {
sinon.stub(reporterProxy, 'addEvent');
wrapper.simulate('click');
assert.isTrue(reporterProxy.addEvent.calledWith('click', {package: 'github', component: 'GithubTileView'}));
});
});