cc97a023cc
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[].
30 lines
896 B
TypeScript
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)
|
|
})
|
|
})
|