Skip to content

Commit

Permalink
test: stricter no match test
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 9, 2025
1 parent f20dbf1 commit 60564fe
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/router/src/new-route-resolver/matcher-resolve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -273,7 +278,7 @@ describe('RouterMatcher.resolve', () => {
assertRecordMatch(
{ path: '/', components },
{ path: '/foo' },
{ params: {}, path: '/foo', matched: [] }
NO_MATCH_LOCATION
)
})

Expand Down

0 comments on commit 60564fe

Please sign in to comment.