Skip to content

Commit

Permalink
test: Flesh out splat tests a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Feb 10, 2025
1 parent 9fb5362 commit 7380ec3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/node/router-match.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test } from 'uvu';
import * as assert from 'uvu/assert';

// @ts-expect-error - no types, not meant for public use
import { exec } from '../../src/router.js';

function execPath(path, pattern, opts) {
Expand All @@ -28,7 +27,10 @@ test('Param rest segment', () => {
const accurateResult = execPath('/user/foo', '/user/*');
assert.equal(accurateResult, { path: '/user/foo', params: {}, query: {}, rest: '/foo' });

const inaccurateResult = execPath('/', '/user/:id/*');
const accurateResult2 = execPath('/user/foo/bar/baz', '/user/*');
assert.equal(accurateResult2, { path: '/user/foo/bar/baz', params: {}, query: {}, rest: '/foo/bar/baz' });

const inaccurateResult = execPath('/user', '/user/*');
assert.equal(inaccurateResult, undefined);
});

Expand Down

0 comments on commit 7380ec3

Please sign in to comment.