mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-11 07:18:25 +00:00
Make client config loading worker-safe
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user