Skip to content

Commit 9bae0c1

Browse files
committed
Improve tests
1 parent 7009f90 commit 9bae0c1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/index.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,4 +405,14 @@ describe('inertia-helpers', () => {
405405
const file = await resolvePageComponent<{ default: string }>(['missing-page', path], import.meta.glob('./__data__/*.ts', { eager: true }), path)
406406
expect(file.default).toBe('Dummy File')
407407
})
408+
409+
it('throws an error when a page is not found', async () => {
410+
const callback = () => resolvePageComponent<{ default: string }>('missing-page', import.meta.glob('./__data__/*.ts'))
411+
await expect(callback).rejects.toThrowError(new Error('Page not found: missing-page'))
412+
})
413+
414+
it('throws an error when a page is not found', async () => {
415+
const callback = () => resolvePageComponent<{ default: string }>(['missing-page-1', 'missing-page-2'], import.meta.glob('./__data__/*.ts'))
416+
await expect(callback).rejects.toThrowError(new Error('Page not found: missing-page-1,missing-page-2'))
417+
})
408418
})

0 commit comments

Comments
 (0)