From: Eduardo San Martin Morote Date: Mon, 6 May 2019 17:06:39 +0000 (+0200) Subject: test: assert arguments on beforeEach with nested routes X-Git-Tag: v4.0.0-alpha.0~380 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=883975c82997235cdab4772a2e56f885932a0b58;p=thirdparty%2Fvuejs%2Frouter.git test: assert arguments on beforeEach with nested routes --- diff --git a/__tests__/guards/global-beforeEach.spec.js b/__tests__/guards/global-beforeEach.spec.js index 4aec5309..91fde0d5 100644 --- a/__tests__/guards/global-beforeEach.spec.js +++ b/__tests__/guards/global-beforeEach.spec.js @@ -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) })