fix: mock provider cache in delegate-task tests for CI stability
- Add spyOn for readConnectedProvidersCache to return connected providers - Tests now work consistently regardless of actual provider cache state - Fixes CI failures for category variant and unstable agent tests
This commit is contained in:
parent
6f348a8a5c
commit
b2d618e851
@ -1,14 +1,17 @@
|
|||||||
import { describe, test, expect, beforeEach, afterEach } from "bun:test"
|
import { describe, test, expect, beforeEach, afterEach, spyOn } from "bun:test"
|
||||||
import { DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS, CATEGORY_DESCRIPTIONS, isPlanAgent, PLAN_AGENT_NAMES } from "./constants"
|
import { DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS, CATEGORY_DESCRIPTIONS, isPlanAgent, PLAN_AGENT_NAMES } from "./constants"
|
||||||
import { resolveCategoryConfig } from "./tools"
|
import { resolveCategoryConfig } from "./tools"
|
||||||
import type { CategoryConfig } from "../../config/schema"
|
import type { CategoryConfig } from "../../config/schema"
|
||||||
import { __resetModelCache } from "../../shared/model-availability"
|
import { __resetModelCache } from "../../shared/model-availability"
|
||||||
import { clearSkillCache } from "../../features/opencode-skill-loader/skill-content"
|
import { clearSkillCache } from "../../features/opencode-skill-loader/skill-content"
|
||||||
import { __setTimingConfig, __resetTimingConfig } from "./timing"
|
import { __setTimingConfig, __resetTimingConfig } from "./timing"
|
||||||
|
import * as connectedProvidersCache from "../../shared/connected-providers-cache"
|
||||||
|
|
||||||
const SYSTEM_DEFAULT_MODEL = "anthropic/claude-sonnet-4-5"
|
const SYSTEM_DEFAULT_MODEL = "anthropic/claude-sonnet-4-5"
|
||||||
|
|
||||||
describe("sisyphus-task", () => {
|
describe("sisyphus-task", () => {
|
||||||
|
let cacheSpy: ReturnType<typeof spyOn>
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
__resetModelCache()
|
__resetModelCache()
|
||||||
clearSkillCache()
|
clearSkillCache()
|
||||||
@ -21,10 +24,12 @@ describe("sisyphus-task", () => {
|
|||||||
MAX_POLL_TIME_MS: 2000,
|
MAX_POLL_TIME_MS: 2000,
|
||||||
SESSION_CONTINUATION_STABILITY_MS: 50,
|
SESSION_CONTINUATION_STABILITY_MS: 50,
|
||||||
})
|
})
|
||||||
|
cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic", "google", "openai"])
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
__resetTimingConfig()
|
__resetTimingConfig()
|
||||||
|
cacheSpy?.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("DEFAULT_CATEGORIES", () => {
|
describe("DEFAULT_CATEGORIES", () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user