mirror of https://github.com/openclaw/openclaw.git
test(cron): stabilize model precedence mocks in bun runs (#31594)
This commit is contained in:
parent
e08ba063d8
commit
a3d2021eea
|
|
@ -385,7 +385,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||
|
||||
it("applies model overrides with correct precedence", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
vi.mocked(loadModelCatalog).mockResolvedValue([
|
||||
const deterministicCatalog = [
|
||||
{
|
||||
id: "gpt-4.1-mini",
|
||||
name: "GPT-4.1 Mini",
|
||||
|
|
@ -396,7 +396,8 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||
name: "Claude Opus 4.5",
|
||||
provider: "anthropic",
|
||||
},
|
||||
]);
|
||||
];
|
||||
vi.mocked(loadModelCatalog).mockResolvedValue(deterministicCatalog);
|
||||
|
||||
let res = (
|
||||
await runCronTurn(home, {
|
||||
|
|
@ -410,7 +411,8 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||
expect(res.status).toBe("ok");
|
||||
expectEmbeddedProviderModel({ provider: "openai", model: "gpt-4.1-mini" });
|
||||
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(runEmbeddedPiAgent).mockClear();
|
||||
vi.mocked(loadModelCatalog).mockResolvedValue(deterministicCatalog);
|
||||
res = (
|
||||
await runTurnWithStoredModelOverride(home, {
|
||||
kind: "agentTurn",
|
||||
|
|
@ -421,7 +423,8 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||
expect(res.status).toBe("ok");
|
||||
expectEmbeddedProviderModel({ provider: "openai", model: "gpt-4.1-mini" });
|
||||
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(runEmbeddedPiAgent).mockClear();
|
||||
vi.mocked(loadModelCatalog).mockResolvedValue(deterministicCatalog);
|
||||
res = (
|
||||
await runTurnWithStoredModelOverride(home, {
|
||||
kind: "agentTurn",
|
||||
|
|
@ -444,7 +447,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||
model: GMAIL_MODEL.replace("openrouter/", ""),
|
||||
});
|
||||
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(runEmbeddedPiAgent).mockClear();
|
||||
res = (
|
||||
await runGmailHookTurn(home, {
|
||||
"agent:main:hook:gmail:msg-1": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue