test: tighten acpx memory assertions

This commit is contained in:
Peter Steinberger
2026-05-11 14:23:32 +01:00
parent ac8a193cbe
commit 5b6f4d6bb6
3 changed files with 12 additions and 20 deletions

View File

@@ -119,13 +119,10 @@ describe("patched claude-agent-acp completion", () => {
expect(resolved).toBe(false);
query.push(makeIdleMessage());
await expect(promptPromise).resolves.toMatchObject({
stopReason: "end_turn",
usage: {
inputTokens: 1,
outputTokens: 1,
},
});
const result = await promptPromise;
expect(result.stopReason).toBe("end_turn");
expect(result.usage?.inputTokens).toBe(1);
expect(result.usage?.outputTokens).toBe(1);
});
it("does not resolve a prompt after a task-notification result goes idle", async () => {
@@ -182,12 +179,9 @@ describe("patched claude-agent-acp completion", () => {
expect(resolved).toBe(false);
query.push(makeIdleMessage());
await expect(promptPromise).resolves.toMatchObject({
stopReason: "end_turn",
usage: {
inputTokens: 2,
outputTokens: 2,
},
});
const result = await promptPromise;
expect(result.stopReason).toBe("end_turn");
expect(result.usage?.inputTokens).toBe(2);
expect(result.usage?.outputTokens).toBe(2);
});
});

View File

@@ -255,7 +255,7 @@ describe("runCodexAppServerSideQuestion", () => {
const forkCall = client.request.mock.calls[0];
expect(forkCall?.[0]).toBe("thread/fork");
const forkParams = forkCall?.[1] as Record<string, unknown> | undefined;
expect(Object.keys(forkParams ?? {}).sort()).toEqual([
expect(Object.keys(forkParams ?? {}).toSorted()).toEqual([
"approvalPolicy",
"approvalsReviewer",
"config",

View File

@@ -449,11 +449,9 @@ describe("memory index", () => {
managersForCleanup.add(second);
const cachedBeforeProbe = second.getCachedEmbeddingAvailability?.();
expect(cachedBeforeProbe).toMatchObject({
ok: true,
checked: true,
cached: true,
});
expect(cachedBeforeProbe?.ok).toBe(true);
expect(cachedBeforeProbe?.checked).toBe(true);
expect(cachedBeforeProbe?.cached).toBe(true);
expect(cachedBeforeProbe?.checkedAtMs).toBeTypeOf("number");
expect(cachedBeforeProbe?.cacheExpiresAtMs).toBeTypeOf("number");
if (