From: zMouse Date: Wed, 15 Jul 2020 12:06:39 +0000 (+0800) Subject: test(warns): add a warning test when `next` is called twice (#371) X-Git-Tag: v4.0.0-beta.3~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27a33892a261f3f2e3bf267999a66ed8b145e1e0;p=thirdparty%2Fvuejs%2Frouter.git test(warns): add a warning test when `next` is called twice (#371) --- diff --git a/__tests__/router.spec.ts b/__tests__/router.spec.ts index e6b8be6d..62c6626d 100644 --- a/__tests__/router.spec.ts +++ b/__tests__/router.spec.ts @@ -354,7 +354,17 @@ describe('Router', () => { it.todo('avoid infinite redirection loops when doing router.back()') - it.todo('warns if `next` is called twice') + it('warns if `next` is called twice', async () => { + const { router } = await newRouter() + router.beforeEach((to, from, next) => { + next() + next() + }) + await router.push('/foo') + expect( + 'It should be called exactly one time in each navigation guard' + ).toHaveBeenWarned() + }) }) describe('alias', () => {