Skip to content

Commit

Permalink
Update Home screen test
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-username committed Mar 29, 2018
1 parent a9774a9 commit 23909e2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/screens/Home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ describe('Home screen test', () => {
expect(navMock.navigate.mock.calls.length).toBe(1);
expect(navMock.navigate.mock.calls[0]).toEqual(['Details', { id: 2 }]);
});

it('should navigate to menu when icon is pressed', () => {
const navMock = {
navigation: {
navigate: jest.fn(),
},
};
const wrapper = shallow(<Home navigation={navMock} />);
const icon = shallow(
wrapper.instance().constructor.navigationOptions(navMock).headerRight
).simulate('press');

expect(navMock.navigation.navigate.mock.calls.length).toBe(1);
expect(navMock.navigation.navigate.mock.calls[0]).toEqual(['Menu']);
});
});

0 comments on commit 23909e2

Please sign in to comment.