Skip to content

Commit 60564fe

Browse files
committed
test: stricter no match test
1 parent f20dbf1 commit 60564fe

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

packages/router/src/new-route-resolver/matcher-resolve.spec.ts

+16-11
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,21 @@ describe('RouterMatcher.resolve', () => {
188188

189189
// console.log({ toLocation, resolved, expectedLocation, resolvedFrom })
190190

191-
expect(
192-
matcher.resolve(
193-
// FIXME: should work now
194-
// @ts-expect-error
195-
typeof toLocation === 'string' ? { path: toLocation } : toLocation,
196-
resolvedFrom === START_LOCATION ? undefined : resolvedFrom
197-
)
198-
).toMatchObject({
199-
...resolved,
200-
})
191+
const result = matcher.resolve(
192+
// FIXME: should work now
193+
// @ts-expect-error
194+
typeof toLocation === 'string' ? { path: toLocation } : toLocation,
195+
resolvedFrom === START_LOCATION ? undefined : resolvedFrom
196+
)
197+
198+
if (
199+
expectedLocation.name === undefined ||
200+
expectedLocation.name !== NO_MATCH_LOCATION.name
201+
) {
202+
expect(result.name).not.toBe(NO_MATCH_LOCATION.name)
203+
}
204+
205+
expect(result).toMatchObject(resolved)
201206
}
202207

203208
describe('LocationAsPath', () => {
@@ -273,7 +278,7 @@ describe('RouterMatcher.resolve', () => {
273278
assertRecordMatch(
274279
{ path: '/', components },
275280
{ path: '/foo' },
276-
{ params: {}, path: '/foo', matched: [] }
281+
NO_MATCH_LOCATION
277282
)
278283
})
279284

0 commit comments

Comments
 (0)