35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { readRepoFile } from "~/utils/testing/repoPaths";
|
|
|
|
const runtimeFiles = [
|
|
"apps/web/app/modules/ipAddress/services/IpAddressService.server.ts",
|
|
"apps/web/app/modules/ipAddress/services/geoip.server.ts",
|
|
"apps/web/app/modules/users/services/AuthService.ts",
|
|
"apps/web/app/modules/workflowEngine/services/blocks/WorkflowBlockService.ts",
|
|
"apps/web/app/routes/admin/analytics/settings.tsx",
|
|
"apps/web/app/routes/app.$tenant/settings.tsx",
|
|
];
|
|
|
|
// AD-22/EXT-12: IpAddressService delegiert die Env-Config an geoip.server.ts; damit ist
|
|
// geoip.server.ts die config-backed Boundary-Datei (loadWebConfig → @toolctrl/config).
|
|
const configBackedRuntimeFiles = [
|
|
"apps/web/app/modules/ipAddress/services/geoip.server.ts",
|
|
"apps/web/app/modules/users/services/AuthService.ts",
|
|
"apps/web/app/routes/admin/analytics/settings.tsx",
|
|
"apps/web/app/routes/app.$tenant/settings.tsx",
|
|
];
|
|
|
|
describe("runtime NODE_ENV boundary", () => {
|
|
it.each(runtimeFiles)("does not read process.env.NODE_ENV directly in %s", (relativePath) => {
|
|
const source = readRepoFile(relativePath);
|
|
|
|
expect(source).not.toMatch(/process\.env\.NODE_ENV\b/);
|
|
});
|
|
|
|
it.each(configBackedRuntimeFiles)("uses @toolctrl/config for runtime environment config in %s", (relativePath) => {
|
|
const source = readRepoFile(relativePath);
|
|
|
|
expect(source).toContain("@toolctrl/config");
|
|
});
|
|
});
|