mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:40:43 +00:00
test: isolate channel option metadata cache
This commit is contained in:
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user