Make client config loading worker-safe

This commit is contained in:
scamiv
2026-03-24 14:12:20 +01:00
parent b9732ce853
commit afd6e3ecaa
2 changed files with 21 additions and 4 deletions
@@ -6,9 +6,12 @@ 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();
});
@@ -21,4 +24,12 @@ describe("ConfigLoader", () => {
expect(config.env()).toBe(GameEnv.Prod);
expect(fetchSpy).not.toHaveBeenCalled();
});
test("falls back to bundled env when bootstrap config is unavailable", async () => {
process.env.GAME_ENV = "prod";
const config = await getServerConfigFromClient();
expect(config.env()).toBe(GameEnv.Prod);
});
});