Download src/cli/channel-options.test.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/cli/channel-options.test.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/cli/channel-options.test.ts
-
curl -L -o channel-options.test.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/cli/channel-options.test.ts
1.13 kB
| // Channel option tests cover channel command option parsing and config resolution. | |
| import { beforeEach, describe, expect, it, vi } from "vitest"; | |
| import { formatCliChannelOptions, resolveCliChannelOptions } from "./channel-options.js"; | |
| const readCliStartupMetadata = vi.hoisted(() => vi.fn()); | |
| vi.mock("./startup-metadata.js", () => ({ readCliStartupMetadata })); | |
| describe("resolveCliChannelOptions", () => { | |
| beforeEach(() => { | |
| readCliStartupMetadata.mockReset(); | |
| }); | |
| it("uses precomputed startup metadata when available", () => { | |
| readCliStartupMetadata.mockReturnValue({ | |
| channelOptions: ["cached", "", false, "quietchat", "cached"], | |
| }); | |
| expect(resolveCliChannelOptions()).toEqual(["cached", "quietchat"]); | |
| expect(formatCliChannelOptions(["all"])).toBe("all|cached|quietchat"); | |
| }); | |
| it("falls back to generic channel text when metadata is missing", () => { | |
| readCliStartupMetadata.mockReturnValue(null); | |
| expect(resolveCliChannelOptions()).toEqual([]); | |
| expect(formatCliChannelOptions()).toBe("channel"); | |
| expect(formatCliChannelOptions(["all"])).toBe("all"); | |
| }); | |
| }); | |