Skip to content

Commit 9dc994a

Browse files
committed
test(errors): test onError for lazy import
1 parent 20f4580 commit 9dc994a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

__tests__/errors.spec.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const routes: RouteRecordRaw[] = [
2121
{ path: '/foo', component: components.Foo, name: 'Foo' },
2222
// prevent the log of no match warnings
2323
{ path: '/:pathMatch(.*)', component: components.Home },
24+
{ path: '/async', component: () => Promise.reject('failed') },
2425
]
2526

2627
const onError = jest.fn()
@@ -52,6 +53,10 @@ describe('Errors & Navigation failures', () => {
5253
)
5354
})
5455

56+
it('lazy loading reject', async () => {
57+
await testError(true, 'failed', '/async')
58+
})
59+
5560
it('Duplicated navigation triggers afterEach', async () => {
5661
let expectedFailure = expect.objectContaining({
5762
type: NavigationFailureType.duplicated,
@@ -315,7 +320,7 @@ describe('isNavigationFailure', () => {
315320

316321
async function testError(
317322
nextArgument: any | NavigationGuard,
318-
expectedError: Error | void = undefined,
323+
expectedError: any = undefined,
319324
to: RouteLocationRaw = '/foo'
320325
) {
321326
const { router } = createRouter()

0 commit comments

Comments
 (0)