From: Eduardo San Martin Morote Date: Tue, 25 Jun 2024 13:59:05 +0000 (+0200) Subject: test: check parsed urls X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=534bb1b3c752f71019d60a0a98025f7439819c15;p=thirdparty%2Fvuejs%2Frouter.git test: check parsed urls --- diff --git a/packages/router/src/new-matcher/matcher.spec.ts b/packages/router/src/new-matcher/matcher.spec.ts index 2660abdd..29f6a40a 100644 --- a/packages/router/src/new-matcher/matcher.spec.ts +++ b/packages/router/src/new-matcher/matcher.spec.ts @@ -43,17 +43,17 @@ describe('Matcher', () => { }) ) - expect(matcher.resolve('/foo/1')).toMatchObject({ + expect(matcher.resolve('/foo/1?a=a&b=b#h')).toMatchObject({ path: '/foo/1', params: { id: 1 }, - query: {}, - hash: '', + query: { a: 'a', b: 'b' }, + hash: '#h', }) - expect(matcher.resolve('/foo/54')).toMatchObject({ + expect(matcher.resolve('/foo/54?a=a&b=b#h')).toMatchObject({ path: '/foo/54', params: { id: 54 }, - query: {}, - hash: '', + query: { a: 'a', b: 'b' }, + hash: '#h', }) }) @@ -68,15 +68,14 @@ describe('Matcher', () => { }) ) - expect(matcher.resolve('/foo?id=100')).toMatchObject({ - hash: '', - params: { - id: 100, - }, + expect(matcher.resolve('/foo?id=100&b=b#h')).toMatchObject({ + params: { id: 100 }, path: '/foo', query: { id: '100', + b: 'b', }, + hash: '#h', }) }) @@ -94,11 +93,11 @@ describe('Matcher', () => { ) ) - expect(matcher.resolve('/foo#bar')).toMatchObject({ + expect(matcher.resolve('/foo?a=a&b=b#bar')).toMatchObject({ hash: '#bar', params: { a: 'bar' }, path: '/foo', - query: {}, + query: { a: 'a', b: 'b' }, }) }) })