feat: add removable reference feature vertical slice
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ROUTE_RUNTIME_CONTRACT } from "../../src/contracts/route-runtime-contract.js";
|
||||
import { ROUTE_REGISTRY } from "../../src/contracts/routes.js";
|
||||
import {
|
||||
buildRouteUrl,
|
||||
parseRouteInput,
|
||||
} from "../../src/presentation/routes/route-codecs.js";
|
||||
import { ROUTE_RUNTIME } from "../../src/presentation/routes/route-runtime.js";
|
||||
ROUTE_REGISTRY,
|
||||
ROUTE_RUNTIME_CONTRACT,
|
||||
} from "../../src/features/installed-feature-contracts.js";
|
||||
import { ROUTE_RUNTIME } from "../../src/features/installed-feature-runtimes.js";
|
||||
import { parseRouteInput } from "../../src/presentation/routes/route-codecs.js";
|
||||
|
||||
describe("typed route contract and runtime", () => {
|
||||
it("keeps contract, runtime contribution, and executable module complete", () => {
|
||||
describe("typed installed route catalog", () => {
|
||||
it("keeps contract and executable runtime contributions complete", () => {
|
||||
expect(Object.keys(ROUTE_RUNTIME_CONTRACT).sort()).toEqual(
|
||||
Object.keys(ROUTE_REGISTRY).sort(),
|
||||
);
|
||||
@@ -18,46 +17,7 @@ describe("typed route contract and runtime", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("round-trips canonical search through the registered codec", () => {
|
||||
const url = buildRouteUrl("SAMPLE_RESOURCE_LIST", {
|
||||
search: {
|
||||
tags: ["open", "new"],
|
||||
cursor: "a/b",
|
||||
limit: 5,
|
||||
},
|
||||
});
|
||||
expect(url).toBe(
|
||||
"/sample/resources?cursor=a%2Fb&limit=5&tags=open&tags=new",
|
||||
);
|
||||
const parsedUrl = new URL(url, "https://app.test");
|
||||
expect(
|
||||
parseRouteInput(
|
||||
"SAMPLE_RESOURCE_LIST",
|
||||
{},
|
||||
parsedUrl.searchParams,
|
||||
),
|
||||
).toEqual({
|
||||
success: true,
|
||||
data: {
|
||||
routeId: "SAMPLE_RESOURCE_LIST",
|
||||
params: {},
|
||||
search: {
|
||||
cursor: "a/b",
|
||||
limit: 5,
|
||||
tags: ["open", "new"],
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects unknown search and accepts the not-found splat owner", () => {
|
||||
expect(
|
||||
parseRouteInput(
|
||||
"SAMPLE_RESOURCE_LIST",
|
||||
{},
|
||||
new URLSearchParams("unknown=value"),
|
||||
),
|
||||
).toEqual({ success: false, code: "ROUTE_SEARCH_INVALID" });
|
||||
it("accepts the platform not-found splat owner", () => {
|
||||
expect(
|
||||
parseRouteInput(
|
||||
"NOT_FOUND",
|
||||
|
||||
Reference in New Issue
Block a user