Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisShank committed Sep 13, 2024
1 parent 0629589 commit e6acba1
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import test from 'node:test';
import assert from 'node:assert';
import { DecodedRouteData, RouteParser, route, string } from './index.js';

interface DecodeFixture {
route: () => RouteParser;
input: string;
expected_match: DecodedRouteData<Record<string, any>>;
error?: true;
}
type DecodeFixture =
| {
route: () => RouteParser;
input: string;
expected_match: DecodedRouteData<Record<string, any>>;
error?: undefined;
}
| {
route: () => RouteParser;
input: string;
expected_match?: undefined;
error: true;
};

// Adapted from the URLPattern test suite: https://github.com/kenchris/urlpattern-polyfill/blob/main/test/urlpatterntestdata.json
const fixtures: DecodeFixture[] = [
Expand Down Expand Up @@ -229,12 +236,6 @@ const fixtures: DecodeFixture[] = [
{
route: () => route`/${['id', string]}/${['id', string]}`,
input: 'Throw error',
expected_match: {
matched: true,
params: {},
search: {},
hash: '',
},
error: true,
},
];
Expand Down

0 comments on commit e6acba1

Please sign in to comment.