Skip to content

Commit

Permalink
update Home component tests and solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukeghenco committed Mar 30, 2017
1 parent 0c226f7 commit 5dc0297
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from 'react';

const Home = () => {
return (<div />);
return (
<div>
<h1>Home Page</h1>
</div>
);
};

export default Home;
10 changes: 6 additions & 4 deletions test/HomeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ import sinon from 'sinon';
import { expect } from 'chai';
import { shallow } from 'enzyme';

// components
import Home from '../src/components/Home';


describe('<Home />', () => {
describe('Home', () => {
let wrapper;

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

it('should only render one <h1 /> inside of the <div />', () => {
const wrapper = shallow(<Home />);
expect(wrapper.children().first().type()).to.equal('h1');
});

it("should render 'Home Page' inside of the <h1 />", () => {
const wrapper = shallow(<Home />);
expect(wrapper.children().first().text()).to.contain('Home Page');
});
});

0 comments on commit 5dc0297

Please sign in to comment.