Initial Commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { runPipelineRouterConformance } from "@suaveplan/api-router/testing/pipeline-router-conformance";
|
||||
|
||||
import { InMemoryRouter } from "../../src/adapter/adapter.js";
|
||||
|
||||
/**
|
||||
* Wire the canonical `PipelineRouter` conformance suite from
|
||||
* `@suaveplan/api-router` to the `InMemoryRouter` pipeline facet.
|
||||
*/
|
||||
runPipelineRouterConformance({
|
||||
label: "InMemoryRouter pipeline facet",
|
||||
build: () => {
|
||||
let r = new InMemoryRouter();
|
||||
const replay: Array<Parameters<typeof r.registerPipelineRoute>[0]> = [];
|
||||
return {
|
||||
router: {
|
||||
match: (method, url) => r.matchPipeline(method, url),
|
||||
},
|
||||
register: (reg) => {
|
||||
r.registerPipelineRoute(reg);
|
||||
replay.push(reg);
|
||||
},
|
||||
reload: () => {
|
||||
r = new InMemoryRouter();
|
||||
for (const reg of replay) r.registerPipelineRoute(reg);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user