Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
add tests for GithubStatusBarTile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilde Ann Thurium committed Sep 25, 2018
1 parent f810ed0 commit 926b033
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/views/github-status-bar-tile.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import {shallow} from 'enzyme';

import GithubStatusBarTile from '../../lib/views/github-status-bar-tile';
import * as reporterProxy from '../../lib/reporter-proxy';

describe('GithubStatusBarTile', function() {
let wrapper, clickSpy;
beforeEach(function() {
clickSpy = sinon.spy();
wrapper = shallow(<GithubStatusBarTile 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: 'GithubStatusBarTile'}));
});
});

0 comments on commit 926b033

Please sign in to comment.