Skip to content

Commit 35ff289

Browse files
committed
Test coverage for array
1 parent c810cd9 commit 35ff289

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/cases.spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type CompileOptions,
77
type ParamData,
88
TokenData,
9+
Path,
910
} from "./index.js";
1011

1112
export interface ParserTestSet {
@@ -21,7 +22,7 @@ export interface StringifyTestSet {
2122
}
2223

2324
export interface CompileTestSet {
24-
path: string;
25+
path: Path;
2526
options?: CompileOptions & ParseOptions;
2627
tests: Array<{
2728
input: ParamData | undefined;
@@ -30,7 +31,7 @@ export interface CompileTestSet {
3031
}
3132

3233
export interface MatchTestSet {
33-
path: string;
34+
path: Path | Path[];
3435
options?: MatchOptions & ParseOptions;
3536
tests: Array<{
3637
input: string;
@@ -1644,4 +1645,20 @@ export const MATCH_TESTS: MatchTestSet[] = [
16441645
},
16451646
],
16461647
},
1648+
1649+
/**
1650+
* Array input is normalized.
1651+
*/
1652+
{
1653+
path: ["/:foo/:bar", "/:foo/:baz"],
1654+
tests: [
1655+
{
1656+
input: "/hello/world",
1657+
expected: {
1658+
path: "/hello/world",
1659+
params: { foo: "hello", bar: "world" },
1660+
},
1661+
},
1662+
],
1663+
},
16471664
];

0 commit comments

Comments
 (0)