From: Eduardo San Martin Morote Date: Thu, 9 Jan 2025 11:04:28 +0000 (+0100) Subject: test: stricter no match test X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a218b243e3c7fc85f07c681ebcc7d8741fb491af;p=thirdparty%2Fvuejs%2Frouter.git test: stricter no match test --- diff --git a/packages/router/src/new-route-resolver/matcher-resolve.spec.ts b/packages/router/src/new-route-resolver/matcher-resolve.spec.ts index a73a0584..66ca21a8 100644 --- a/packages/router/src/new-route-resolver/matcher-resolve.spec.ts +++ b/packages/router/src/new-route-resolver/matcher-resolve.spec.ts @@ -188,16 +188,21 @@ describe('RouterMatcher.resolve', () => { // console.log({ toLocation, resolved, expectedLocation, resolvedFrom }) - expect( - matcher.resolve( - // FIXME: should work now - // @ts-expect-error - typeof toLocation === 'string' ? { path: toLocation } : toLocation, - resolvedFrom === START_LOCATION ? undefined : resolvedFrom - ) - ).toMatchObject({ - ...resolved, - }) + const result = matcher.resolve( + // FIXME: should work now + // @ts-expect-error + typeof toLocation === 'string' ? { path: toLocation } : toLocation, + resolvedFrom === START_LOCATION ? undefined : resolvedFrom + ) + + if ( + expectedLocation.name === undefined || + expectedLocation.name !== NO_MATCH_LOCATION.name + ) { + expect(result.name).not.toBe(NO_MATCH_LOCATION.name) + } + + expect(result).toMatchObject(resolved) } describe('LocationAsPath', () => { @@ -273,7 +278,7 @@ describe('RouterMatcher.resolve', () => { assertRecordMatch( { path: '/', components }, { path: '/foo' }, - { params: {}, path: '/foo', matched: [] } + NO_MATCH_LOCATION ) })