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