]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: assert arguments on beforeEach with nested routes
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 6 May 2019 17:06:39 +0000 (19:06 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 6 May 2019 17:06:39 +0000 (19:06 +0200)
__tests__/guards/global-beforeEach.spec.js

index 4aec5309227a8605958c7283d0233a1e33911c5c..91fde0d580770903e36c70f9149e53ef44866670 100644 (file)
@@ -83,7 +83,17 @@ describe('router.beforeEach', () => {
         spy.mockImplementation(noGuard)
         await router[navigationMethod]('/nested/home')
         expect(spy).toHaveBeenCalledTimes(1)
+        expect(spy).toHaveBeenLastCalledWith(
+          expect.objectContaining({ name: 'nested-home' }),
+          expect.objectContaining({ name: 'nested-default' }),
+          expect.any(Function)
+        )
         await router[navigationMethod]('/nested')
+        expect(spy).toHaveBeenLastCalledWith(
+          expect.objectContaining({ name: 'nested-default' }),
+          expect.objectContaining({ name: 'nested-home' }),
+          expect.any(Function)
+        )
         expect(spy).toHaveBeenCalledTimes(2)
       })