Created
January 14, 2017 19:36
-
-
Save mtheoryx/fde7ad11c1c677b132aa2372e550e110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { shallow } from 'enzyme'; | |
| // Subject Under Test | |
| import App from './App'; | |
| const app = shallow(<App />); | |
| test('Renders nested components', () => { | |
| expect(app.find('Header').length).toEqual(1); | |
| expect(app.find('Intro').length).toEqual(1); | |
| expect(app.find('Students').length).toEqual(1); | |
| expect(app.find('Summary').length).toEqual(1); | |
| }); | |
| test('Can add a student', () => { | |
| const add = app.find('Students').first(); | |
| const mockNewStudent = { | |
| name: 'Jimmy Johns', | |
| grade: 65 | |
| }; | |
| add.props().addStudent(mockNewStudent); | |
| const addStudent = jest.fn(); | |
| expect(addStudent).toBeCalled(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment