From: Eduardo San Martin Morote Date: Sun, 24 May 2020 13:59:30 +0000 (+0200) Subject: test: improve matcher add/remove tests X-Git-Tag: v4.0.0-alpha.13~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b0ea66ef61905b07439e6feb36f50824a487a59;p=thirdparty%2Fvuejs%2Frouter.git test: improve matcher add/remove tests --- diff --git a/__tests__/matcher/addingRemoving.spec.ts b/__tests__/matcher/addingRemoving.spec.ts index d6b313a3..5fe3d841 100644 --- a/__tests__/matcher/addingRemoving.spec.ts +++ b/__tests__/matcher/addingRemoving.spec.ts @@ -158,6 +158,7 @@ describe('Matcher: adding and removing records', () => { const matcher = createRouterMatcher([], {}) matcher.addRoute({ path: '/', component, name: 'home' }) matcher.removeRoute('home') + expect(matcher.getRoutes()).toHaveLength(0) expect(matcher.resolve({ path: '/' }, currentLocation)).toMatchObject({ name: undefined, matched: [], @@ -200,7 +201,9 @@ describe('Matcher: adding and removing records', () => { ], }) + expect(matcher.getRoutes()).toHaveLength(2) matcher.removeRoute('child') + expect(matcher.getRoutes()).toHaveLength(1) expect(matcher.resolve({ path: '/about' }, currentLocation)).toMatchObject({ name: undefined, @@ -230,6 +233,7 @@ describe('Matcher: adding and removing records', () => { }) matcher.removeRoute('home') + expect(matcher.getRoutes()).toHaveLength(0) expect(matcher.resolve({ path: '/about' }, currentLocation)).toMatchObject({ name: undefined, @@ -249,6 +253,7 @@ describe('Matcher: adding and removing records', () => { }) matcher.removeRoute('home') + expect(matcher.getRoutes()).toHaveLength(0) expect(matcher.resolve({ path: '/start' }, currentLocation)).toMatchObject({ name: undefined, @@ -283,6 +288,7 @@ describe('Matcher: adding and removing records', () => { }) matcher.removeRoute('home') + expect(matcher.getRoutes()).toHaveLength(0) ;[ '/', '/start', @@ -325,6 +331,8 @@ describe('Matcher: adding and removing records', () => { matcher.removeRoute('child') + expect(matcher.getRoutes()).toHaveLength(2) + expect(matcher.resolve({ path: '/about' }, currentLocation)).toMatchObject({ name: undefined, matched: [],