29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { validateAppConfig } from "../src/config.ts";
|
|
|
|
// A stale config must fail loudly. Silently ignoring a removed key leaves
|
|
// someone believing a flag still applies.
|
|
const REMOVED = [
|
|
{ key: "compatibilityDate", config: { compatibilityDate: "2026-08-02" } },
|
|
{ key: "frameworkBehaviour", config: { frameworkBehaviour: 1 } },
|
|
{ key: "functions", config: { functions: { legacyDefaultRuntime: "current" } } },
|
|
{ key: "compatibility", config: { compatibility: { legacyEmit: false } } },
|
|
];
|
|
|
|
for (const { key, config } of REMOVED) {
|
|
test(`a config still setting "${key}" is rejected with a message naming it`, () => {
|
|
const issues = validateAppConfig(config as never);
|
|
const match = issues.find((issue) => issue.path === key || issue.path.startsWith(`${key}.`));
|
|
|
|
expect(match).toBeDefined();
|
|
expect(match!.severity).toBe("error");
|
|
expect(match!.message.toLowerCase()).toContain("removed");
|
|
});
|
|
}
|
|
|
|
test("a config without those keys is accepted", () => {
|
|
const issues = validateAppConfig({} as never);
|
|
|
|
expect(issues.filter((issue) => issue.severity === "error")).toEqual([]);
|
|
});
|