89 lines
2.8 KiB
TypeScript
89 lines
2.8 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
import { SERVER_STATE_PROFILES } from "../../src/contracts/server-state.ts";
|
|
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts";
|
|
import { INSTALLED_RUNTIME_CAPABILITIES } from "../../src/features/installed-runtime-capabilities.ts";
|
|
import {
|
|
describeRuntimeCapabilities,
|
|
type CapabilityOverrideMap,
|
|
} from "../../src/contracts/runtime-capabilities.ts";
|
|
|
|
const LOCAL_CAPABILITY_OVERRIDES = (
|
|
JSON.parse(
|
|
readFileSync(
|
|
new URL("../../config/runtime/local.json", import.meta.url),
|
|
"utf8",
|
|
),
|
|
) as Readonly<{ CAPABILITY_OVERRIDES: CapabilityOverrideMap }>
|
|
).CAPABILITY_OVERRIDES;
|
|
|
|
/**
|
|
* The overview is a projection of the installed registries. These assertions
|
|
* read the same registries the shipped bundle was built from, so they keep
|
|
* meaning after a feature is added or removed.
|
|
*/
|
|
|
|
test("projects the installed route registry into the shipped bundle", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/examples/platform");
|
|
await expect(
|
|
page.getByRole("heading", { name: "플랫폼 구성", level: 1 }),
|
|
).toBeVisible();
|
|
|
|
const table = page.getByRole("table", { name: "설치된 라우트 목록" });
|
|
await expect(table.locator("tbody tr")).toHaveCount(
|
|
Object.keys(ROUTE_REGISTRY).length,
|
|
);
|
|
for (const routeId of Object.keys(ROUTE_REGISTRY)) {
|
|
await expect(table.getByText(routeId, { exact: true })).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test("shows every fixed server-state profile", async ({ page }) => {
|
|
await page.goto("/examples/platform");
|
|
|
|
const table = page.getByRole("table", { name: "서버 상태 프로파일" });
|
|
await expect(table.locator("tbody tr")).toHaveCount(
|
|
Object.keys(SERVER_STATE_PROFILES).length,
|
|
);
|
|
});
|
|
|
|
test("states the release contract identity verified at boot", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/examples/platform");
|
|
|
|
const release = page.locator(
|
|
"section[aria-labelledby='platform-release-title']",
|
|
);
|
|
await expect(release.getByText(/^sha256:/)).toBeVisible();
|
|
});
|
|
|
|
test("reports an unselected capability without claiming it was disabled", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/examples/platform");
|
|
|
|
const capabilities = page.locator(
|
|
"section[aria-labelledby='platform-capabilities-title']",
|
|
);
|
|
const snapshot = describeRuntimeCapabilities(
|
|
INSTALLED_RUNTIME_CAPABILITIES,
|
|
LOCAL_CAPABILITY_OVERRIDES,
|
|
);
|
|
const expectedUnselected = snapshot.filter(
|
|
(status) => status.selected === 0,
|
|
).length;
|
|
const expectedDisabled = snapshot.filter(
|
|
(status) => status.selected > 0 && status.active === 0,
|
|
).length;
|
|
|
|
await expect(capabilities.getByText("미선택")).toHaveCount(
|
|
expectedUnselected,
|
|
);
|
|
await expect(capabilities.getByText("운영자가 비활성화함")).toHaveCount(
|
|
expectedDisabled,
|
|
);
|
|
});
|