test(cron): assert embedded model on last call to avoid bun ordering flake
Bun runs can trigger multiple embedded agent invocations in a single cron turn (e.g. retries/fallbacks), making assertions against call[0] flaky. Assert against the last invocation instead.
This commit is contained in:
committed by
Peter Steinberger
parent
73e08ed7b0
commit
4d19dc8671
@@ -427,7 +427,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
});
|
||||
|
||||
expect(res.status).toBe("ok");
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls[0]?.[0] as { prompt?: string };
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] as { prompt?: string };
|
||||
expect(call?.prompt).toContain("EXTERNAL, UNTRUSTED");
|
||||
expect(call?.prompt).toContain("Hello");
|
||||
});
|
||||
@@ -449,7 +449,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
});
|
||||
|
||||
expect(res.status).toBe("ok");
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls[0]?.[0] as { prompt?: string };
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] as { prompt?: string };
|
||||
expect(call?.prompt).not.toContain("EXTERNAL, UNTRUSTED");
|
||||
expect(call?.prompt).toContain("Hello");
|
||||
});
|
||||
@@ -486,7 +486,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
});
|
||||
|
||||
expect(res.status).toBe("ok");
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls[0]?.[0] as {
|
||||
const call = vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] as {
|
||||
provider?: string;
|
||||
model?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user