Download packages/app/src/context/local-agent.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/local-agent.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/context/local-agent.test.ts
-
curl -L -o local-agent.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/local-agent.test.ts
955 Bytes
| import { describe, expect, test } from "bun:test" | |
| import { hasCustomAgent, resolveAgent } from "./local-agent" | |
| describe("hasCustomAgent", () => { | |
| test("detects explicitly custom agents", () => { | |
| expect(hasCustomAgent([{ native: true }, { native: false }])).toBe(true) | |
| }) | |
| test("ignores built-in and unclassified agents", () => { | |
| expect(hasCustomAgent([{ native: true }, {}])).toBe(false) | |
| }) | |
| }) | |
| describe("resolveAgent", () => { | |
| const agents = [{ name: "plan" }, { name: "build" }, { name: "custom" }] | |
| test("uses the requested available agent", () => { | |
| expect(resolveAgent(agents, "custom")?.name).toBe("custom") | |
| }) | |
| test("defaults to build", () => { | |
| expect(resolveAgent(agents)?.name).toBe("build") | |
| expect(resolveAgent(agents, "missing")?.name).toBe("build") | |
| }) | |
| test("uses the first agent when build is unavailable", () => { | |
| expect(resolveAgent([{ name: "custom" }], "missing")?.name).toBe("custom") | |
| }) | |
| }) | |