test(gateway): fix nix mode mock toggle
This commit is contained in:
@@ -134,7 +134,7 @@ let testLegacyIssues: Array<{ path: string; message: string }> = [];
|
|||||||
let testLegacyParsed: Record<string, unknown> = {};
|
let testLegacyParsed: Record<string, unknown> = {};
|
||||||
let testMigrationConfig: Record<string, unknown> | null = null;
|
let testMigrationConfig: Record<string, unknown> | null = null;
|
||||||
let testMigrationChanges: string[] = [];
|
let testMigrationChanges: string[] = [];
|
||||||
let testIsNixMode = false;
|
const testIsNixMode = vi.hoisted(() => ({ value: false }));
|
||||||
const sessionStoreSaveDelayMs = vi.hoisted(() => ({ value: 0 }));
|
const sessionStoreSaveDelayMs = vi.hoisted(() => ({ value: 0 }));
|
||||||
vi.mock("../config/sessions.js", async () => {
|
vi.mock("../config/sessions.js", async () => {
|
||||||
const actual = await vi.importActual<typeof import("../config/sessions.js")>(
|
const actual = await vi.importActual<typeof import("../config/sessions.js")>(
|
||||||
@@ -223,7 +223,9 @@ vi.mock("../config/config.js", () => {
|
|||||||
return {
|
return {
|
||||||
CONFIG_PATH_CLAWDIS: resolveConfigPath(),
|
CONFIG_PATH_CLAWDIS: resolveConfigPath(),
|
||||||
STATE_DIR_CLAWDIS: path.dirname(resolveConfigPath()),
|
STATE_DIR_CLAWDIS: path.dirname(resolveConfigPath()),
|
||||||
isNixMode: testIsNixMode,
|
get isNixMode() {
|
||||||
|
return testIsNixMode.value;
|
||||||
|
},
|
||||||
migrateLegacyConfig: (raw: unknown) => ({
|
migrateLegacyConfig: (raw: unknown) => ({
|
||||||
config: testMigrationConfig ?? (raw as Record<string, unknown>),
|
config: testMigrationConfig ?? (raw as Record<string, unknown>),
|
||||||
changes: testMigrationChanges,
|
changes: testMigrationChanges,
|
||||||
@@ -310,7 +312,7 @@ beforeEach(async () => {
|
|||||||
testLegacyParsed = {};
|
testLegacyParsed = {};
|
||||||
testMigrationConfig = null;
|
testMigrationConfig = null;
|
||||||
testMigrationChanges = [];
|
testMigrationChanges = [];
|
||||||
testIsNixMode = false;
|
testIsNixMode.value = false;
|
||||||
cronIsolatedRun.mockClear();
|
cronIsolatedRun.mockClear();
|
||||||
drainSystemEvents();
|
drainSystemEvents();
|
||||||
resetAgentRunContextForTest();
|
resetAgentRunContextForTest();
|
||||||
@@ -574,7 +576,7 @@ describe("gateway server", () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
testLegacyParsed = { routing: { allowFrom: ["+15555550123"] } };
|
testLegacyParsed = { routing: { allowFrom: ["+15555550123"] } };
|
||||||
testIsNixMode = true;
|
testIsNixMode.value = true;
|
||||||
|
|
||||||
const port = await getFreePort();
|
const port = await getFreePort();
|
||||||
await expect(startGatewayServer(port)).rejects.toThrow(
|
await expect(startGatewayServer(port)).rejects.toThrow(
|
||||||
|
|||||||
Reference in New Issue
Block a user