Use bundled GAME_ENV for client config

This commit is contained in:
scamiv
2026-03-24 14:42:25 +01:00
parent 496f1008bb
commit 73a2726d5b
2 changed files with 10 additions and 15 deletions
@@ -6,14 +6,16 @@ import {
} from "../../../src/core/configuration/ConfigLoader";
describe("ConfigLoader", () => {
const originalGameEnv = process.env.GAME_ENV;
beforeEach(() => {
vi.restoreAllMocks();
window.BOOTSTRAP_CONFIG = undefined;
process.env.GAME_ENV = originalGameEnv;
clearCachedServerConfig();
});
test("uses bootstrap config without fetching /api/env", async () => {
window.BOOTSTRAP_CONFIG = { gameEnv: "prod" };
test("uses bundled GAME_ENV without fetching /api/env", async () => {
process.env.GAME_ENV = "prod";
const fetchSpy = vi.spyOn(globalThis, "fetch");
const config = await getServerConfigFromClient();