From a218b243e3c7fc85f07c681ebcc7d8741fb491af Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 9 Jan 2025 12:04:28 +0100 Subject: [PATCH] test: stricter no match test --- .../matcher-resolve.spec.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) 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 ) }) -- 2.47.2