test: update heartbeat and agent list thresholds
This commit is contained in:
@@ -22,6 +22,7 @@ vi.mock("./model-auth.js", () => ({
|
|||||||
getApiKeyForModel: vi.fn(),
|
getApiKeyForModel: vi.fn(),
|
||||||
ensureAuthProfileStore: vi.fn(() => ({ profiles: {} })),
|
ensureAuthProfileStore: vi.fn(() => ({ profiles: {} })),
|
||||||
resolveAuthProfileOrder: vi.fn(() => []),
|
resolveAuthProfileOrder: vi.fn(() => []),
|
||||||
|
resolveEnvApiKey: vi.fn(() => null),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("../providers/github-copilot-token.js", async () => {
|
vi.mock("../providers/github-copilot-token.js", async () => {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ describe("stripHeartbeatToken", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("keeps heartbeat replies when remaining content exceeds threshold", () => {
|
it("keeps heartbeat replies when remaining content exceeds threshold", () => {
|
||||||
const long = "A".repeat(31);
|
const long = "A".repeat(350);
|
||||||
expect(
|
expect(
|
||||||
stripHeartbeatToken(`${long} ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" }),
|
stripHeartbeatToken(`${long} ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" }),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ describe("runCronIsolatedAgentTurn", () => {
|
|||||||
sendMessageIMessage: vi.fn(),
|
sendMessageIMessage: vi.fn(),
|
||||||
};
|
};
|
||||||
// Long content after HEARTBEAT_OK should still be delivered.
|
// Long content after HEARTBEAT_OK should still be delivered.
|
||||||
const longContent = `Important alert: ${"a".repeat(50)}`;
|
const longContent = `Important alert: ${"a".repeat(350)}`;
|
||||||
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
|
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
|
||||||
payloads: [{ text: `HEARTBEAT_OK ${longContent}` }],
|
payloads: [{ text: `HEARTBEAT_OK ${longContent}` }],
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ describe("gateway server agents", () => {
|
|||||||
expect(res.payload?.agents.map((agent) => agent.id)).toEqual([
|
expect(res.payload?.agents.map((agent) => agent.id)).toEqual([
|
||||||
"work",
|
"work",
|
||||||
"home",
|
"home",
|
||||||
|
"main",
|
||||||
]);
|
]);
|
||||||
const work = res.payload?.agents.find((agent) => agent.id === "work");
|
const work = res.payload?.agents.find((agent) => agent.id === "work");
|
||||||
const home = res.payload?.agents.find((agent) => agent.id === "home");
|
const home = res.payload?.agents.find((agent) => agent.id === "home");
|
||||||
|
|||||||
Reference in New Issue
Block a user