Skip to content

Commit 80322f0

Browse files
committed
Add path-validation test to middleware.test.ts
Verified that `mapActorAlias()` rejects paths containing route variables in `middleware.test.ts`, matching the behavior tested in `builder.test.ts`. Assisted-by: Gemini CLI:gemini-3-flash-preview Assisted-by: Codex:gpt-5.5
1 parent 82658ee commit 80322f0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/fedify/src/federation/middleware.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,16 @@ test({
300300
new URL("https://example.com/nodeinfo/2.1"),
301301
);
302302

303+
assertThrows(
304+
() =>
305+
createFederation<number>({
306+
kv: new MemoryKvStore(),
307+
}).setActorDispatcher("/users/{identifier}", () => null)
308+
.mapActorAlias("/actor/{id}" as `/${string}`, "instance"),
309+
RouterError,
310+
"Path for actor alias must have no variables.",
311+
);
312+
303313
federation
304314
.setActorDispatcher("/users/{identifier}", () => new vocab.Person({}))
305315
.mapActorAlias("/bot", "bot")

0 commit comments

Comments
 (0)