24 lines
744 B
TypeScript
24 lines
744 B
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
|
|
const ROUTES_WITH_LOCAL_FALLBACKS = [
|
|
"app/(chat)/api/models/route.ts",
|
|
"app/api/favicon/route.ts",
|
|
"app/api/site-settings/route.ts",
|
|
"app/api/user/membership-summary/route.ts",
|
|
];
|
|
|
|
test("requires an explicit environment switch for local fallbacks", () => {
|
|
for (const path of ROUTES_WITH_LOCAL_FALLBACKS) {
|
|
const source = readFileSync(resolve(process.cwd(), path), "utf8");
|
|
|
|
expect(source, path).toContain(
|
|
'process.env.CANVAS_E2E_LOCAL === "true"'
|
|
);
|
|
expect(source, path).not.toMatch(
|
|
/CANVAS_E2E_LOCAL[\s\S]{0,220}\|\|[\s\S]{0,120}(localhost|127\.0\.0\.1|::1)/
|
|
);
|
|
}
|
|
});
|