Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Aug 3, 2020
1 parent e91dd0e commit 08ad737
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/api/src/tests/stories.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@ describe('stories API', () => {
expect(navigate).toHaveBeenCalledWith('/story/a--1');
});

it('DOES not navigate if the story was already selected', async () => {
const navigate = jest.fn();
const api = Object.assign(new EventEmitter(), {
isSettingsScreenActive() {
return true;
},
});
const store = createMockStore({ viewMode: 'story', storyId: 'a--1' });
initStories({ store, navigate, provider, fullAPI: api });

api.emit(STORY_SPECIFIED, { storyId: 'a--1', viewMode: 'story' });

expect(navigate).not.toHaveBeenCalled();
});

it('DOES not navigate if a settings page was selected', async () => {
const navigate = jest.fn();
const api = Object.assign(new EventEmitter(), {
Expand Down

0 comments on commit 08ad737

Please sign in to comment.