Skip to content

Commit

Permalink
add tests for App component
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukeghenco committed Mar 30, 2017
1 parent 0c4620e commit 49d7cd1
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions test/AppTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,44 @@ import { expect } from 'chai';
import { shallow } from 'enzyme';

// Components
import App from '../src/components/App';
import NavBar from '../src/components/NavBar';
import App from '../src/containers/App';

describe('<App />', () => {
it('should contain a <NavBar /> component', () => {
const wrapper = shallow(<App />);
expect(wrapper.find(NavBar).length).to.equal(1);
let wrapper;

beforeEach(() => {
wrapper = shallow(<App />);
})

it('wraps the component in a div with className .app', () => {
expect(wrapper.find('.app').length).to.equal(1);
})

it('contains a <NavBar /> component', () => {
expect(wrapper.find('NavBar').length).to.equal(1);
});

it('contains a <Route path="/">', () => {
const route = wrapper.findWhere(n => n.props().path === '/')
expect(route).to.not.be.undefined;
expect(route.props().path).to.equal('/');
})

it('contains a <Route path="/actors">', () => {
const route = wrapper.findWhere(n => n.props().path === '/actors')
expect(route).to.not.be.undefined;
expect(route.props().path).to.equal('/actors');
})

it('contains a <Route path="/directors">', () => {
const route = wrapper.findWhere(n => n.props().path === '/directors')
expect(route).to.not.be.undefined;
expect(route.props().path).to.equal('/directors');
})

it('contains a <Route path="/movies">', () => {
const route = wrapper.findWhere(n => n.props().path === '/movies')
expect(route).to.not.be.undefined;
expect(route.props().path).to.equal('/movies');
})
});

0 comments on commit 49d7cd1

Please sign in to comment.