Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
evenchange4 committed Jun 6, 2024
1 parent 2d790f3 commit 618746e
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions packages/router/src/__tests__/pathRanking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,32 @@ describe('tokensToParser', () => {

it('patch score for pageBranch which ends with empty route', () => {
expect(
tokensToParser(tokenizePath('/home'), {}, { routes: [LeafPageRoute] }).score
tokensToParser(
tokenizePath('/home'),
{},
{ routes: [{ path: '/home' }, LeafPageRoute] }
).score
).toStrictEqual([[80], [80]]);
expect(
tokensToParser(tokenizePath('/:symbol'), {}, { routes: [LeafPageRoute] })
.score
tokensToParser(
tokenizePath('/:symbol'),
{},
{ routes: [{ path: '/:symbol' }, LeafPageRoute] }
).score
).toStrictEqual([[60], [80]]);
expect(
tokensToParser(tokenizePath('/:symbol/calc'), {}, { routes: [LeafPageRoute] })
.score
tokensToParser(
tokenizePath('/:symbol/calc'),
{},
{ routes: [{ path: '/:symbol' }, { path: '/calc' }, LeafPageRoute] }
).score
).toStrictEqual([[60], [80], [80]]);
expect(
tokensToParser(tokenizePath('/*'), {}, { routes: [LeafPageRoute] }).score
tokensToParser(
tokenizePath('/*'),
{},
{ routes: [{ path: '/*' }, LeafPageRoute] }
).score
).toStrictEqual([[19], [80]]);
});
});
Expand Down

0 comments on commit 618746e

Please sign in to comment.