Files
oh-my-opencode/src/agents/builtin-agents/available-skills.test.ts
T
YeonGyu-Kim cc97a023cc test(agents): drop unsafe AgentFactory cast and add typed empty skills
Tests that mock an AgentFactory were using an `as AgentFactory` cast
and a separate mutation of `mockFactory.mode` to satisfy the type.
Replace with Object.assign so the factory type is constructed correctly
without casts. Also type the empty discoveredSkills fixture so its
element type is inferred from the function signature instead of
collapsing to never[].
2026-05-17 00:09:21 +09:00

30 lines
896 B
TypeScript

import { describe, expect, test } from "bun:test"
import { buildAvailableSkills } from "./available-skills"
type DiscoveredSkills = Parameters<typeof buildAvailableSkills>[0]
describe("buildAvailableSkills", () => {
test("includes team-mode when team mode is enabled", () => {
// given
const discoveredSkills: DiscoveredSkills = []
// when
const availableSkills = buildAvailableSkills(discoveredSkills, undefined, undefined, true)
// then
expect(availableSkills.some((skill) => skill.name === "team-mode")).toBe(true)
})
test("excludes team-mode when team mode is disabled", () => {
// given
const discoveredSkills: DiscoveredSkills = []
// when
const availableSkills = buildAvailableSkills(discoveredSkills, undefined, undefined, false)
// then
expect(availableSkills.some((skill) => skill.name === "team-mode")).toBe(false)
})
})