diff --git a/src/cli/channel-options.test.ts b/src/cli/channel-options.test.ts index bb7ca02835b..51e1d639b6a 100644 --- a/src/cli/channel-options.test.ts +++ b/src/cli/channel-options.test.ts @@ -1,4 +1,4 @@ -import { afterEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { __testing, resolveCliChannelOptions } from "./channel-options.js"; import { __testing as startupMetadataTesting } from "./startup-metadata.js"; @@ -22,12 +22,17 @@ vi.mock("../channels/ids.js", () => ({ })); describe("resolveCliChannelOptions", () => { - afterEach(() => { + beforeEach(() => { __testing.resetPrecomputedChannelOptionsForTests(); startupMetadataTesting.clearStartupMetadataCache(); vi.clearAllMocks(); }); + afterEach(() => { + __testing.resetPrecomputedChannelOptionsForTests(); + delete process.env.OPENCLAW_PLUGIN_CATALOG_PATHS; + }); + it("uses precomputed startup metadata when available", async () => { readFileSyncMock.mockReturnValue( JSON.stringify({ channelOptions: ["cached", "quietchat", "cached"] }), @@ -49,6 +54,5 @@ describe("resolveCliChannelOptions", () => { readFileSyncMock.mockReturnValue(JSON.stringify({ channelOptions: ["cached", "quietchat"] })); expect(resolveCliChannelOptions()).toEqual(["cached", "quietchat"]); - delete process.env.OPENCLAW_PLUGIN_CATALOG_PATHS; }); });