Skip to content

Commit

Permalink
FIX eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushiknishchay committed Apr 2, 2018
1 parent 35237bb commit e7173b3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom --verbose",
"eject": "react-scripts eject",
"test:coverage": "react-scripts test --env=jsdom --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"test:coverage": "react-scripts test --env=jsdom --coverage && cat ./coverage/lcov.info | coveralls",
"lint": "(eslint --ext=js --ext=jsx . ) && echo Lint Passed! ALL Clear! ❤"
},
"devDependencies": {
Expand Down
34 changes: 34 additions & 0 deletions src/components/__test__/Header.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { shallow } from 'enzyme';
import React from 'react';
import Header from '../Header';

describe('<Header /> Component', () => {
it('should show Sign In Button', () => {
const onClick = jest.fn();

const wrapper = shallow(<Header isSignIn={false} onClick={onClick} />);

const btn = wrapper.find('button');

expect(btn.text()).toBe('Sign In');

btn.simulate('click', 'text');

expect(onClick.mock.calls[0][0]).toBe('text');
expect(onClick).toHaveBeenCalledTimes(1);
});
it('should show Sign Out Button', () => {
const onClick = jest.fn();

const wrapper = shallow(<Header isSignIn onClick={onClick} />);

const btn = wrapper.find('button');

expect(btn.text()).toBe('Sign Out');

btn.simulate('click', 'text');

expect(onClick.mock.calls[0][0]).toBe('text');
});
});

6 changes: 6 additions & 0 deletions src/containers/__test__/Header.test.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import React from 'react';
import { shallow } from 'enzyme';
import Header from '../../components/Header';
import HeaderContainer from '../Header';

describe('Header Container Component', () => {
it('should render', () => {
const wrapper = shallow(<HeaderContainer />);
expect(wrapper.length).toBe(1);
});

it('should show Sign In Button', () => {
const onClick = jest.fn();

Expand Down

0 comments on commit e7173b3

Please sign in to comment.