Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 831e3a7

Browse files
author
Tilde Ann Thurium
committed
fix tests for ChangedFilesCountView
1 parent 0260412 commit 831e3a7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/views/changed-files-count-view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class ChangedFilesCountView extends React.Component {
2121
static defaultProps = {
2222
changedFilesCount: 0,
2323
mergeConflictsPresent: false,
24+
tooltips: {},
2425
didClick: () => {},
2526
}
2627

test/views/changed-files-count-view.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import {shallow} from 'enzyme';
33

4-
import ChangedFilesCountView from '../../lib/views/changed-files-count-view';
4+
import ChangedFilesCountView, {tooltipMessage} from '../../lib/views/changed-files-count-view';
55
import * as reporterProxy from '../../lib/reporter-proxy';
66

77
describe('ChangedFilesCountView', function() {
@@ -27,10 +27,17 @@ describe('ChangedFilesCountView', function() {
2727
assert.isTrue(wrapper.text().includes('Git (2)'));
2828
});
2929

30+
it('renders tooltip', function() {
31+
wrapper = shallow(<ChangedFilesCountView />);
32+
const tooltip = wrapper.find('Tooltip');
33+
assert.isTrue(tooltip.props().title.includes(tooltipMessage));
34+
});
35+
36+
3037
it('records an event on click', function() {
3138
sinon.stub(reporterProxy, 'addEvent');
3239
wrapper = shallow(<ChangedFilesCountView />);
33-
wrapper.simulate('click');
40+
wrapper.find('button').simulate('click');
3441
assert.isTrue(reporterProxy.addEvent.calledWith('click', {package: 'github', component: 'ChangedFileCountView'}));
3542
});
3643
});

0 commit comments

Comments
 (0)