forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchanged-files-count-view.test.js
36 lines (29 loc) · 1.3 KB
/
changed-files-count-view.test.js
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
30
31
32
33
34
35
36
import React from 'react';
import {shallow} from 'enzyme';
import ChangedFilesCountView from '../../lib/views/changed-files-count-view';
import * as reporterProxy from '../../lib/reporter-proxy';
describe('ChangedFilesCountView', function() {
let wrapper;
it('renders diff icon', function() {
wrapper = shallow(<ChangedFilesCountView />);
assert.isTrue(wrapper.html().includes('git-commit'));
});
it('renders merge conflict icon if there is a merge conflict', function() {
wrapper = shallow(<ChangedFilesCountView mergeConflictsPresent={true} />);
assert.isTrue(wrapper.html().includes('icon-alert'));
});
it('renders singular count for one file', function() {
wrapper = shallow(<ChangedFilesCountView changedFilesCount={1} />);
assert.isTrue(wrapper.text().includes('Git (1)'));
});
it('renders multiple count if more than one file', function() {
wrapper = shallow(<ChangedFilesCountView changedFilesCount={2} />);
assert.isTrue(wrapper.text().includes('Git (2)'));
});
it('records an event on click', function() {
sinon.stub(reporterProxy, 'addEvent');
wrapper = shallow(<ChangedFilesCountView />);
wrapper.simulate('click');
assert.isTrue(reporterProxy.addEvent.calledWith('click', {package: 'github', component: 'ChangedFileCountView'}));
});
});