/* eslint-disable import/no-named-as-default-member */ import SUT from './routing.service' describe('Routing Service', () => { describe('navigate', () => { it('should dispatch a navigate event', () => { // when... we call the navigate function const navigator: any = { dispatch: jest.fn(), } SUT.setTopLevelNavigator(navigator) SUT.navigate('test', { test: 'something', }) // then... a NavigationActions.navigate action should be dispatched expect(navigator.dispatch).toHaveBeenCalledWith({ type: 'NAVIGATE', payload: { name: 'test', params: { test: 'something', }, }, }) }) }) })