mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:40:43 +00:00
test: clarify codex app-server assertions
This commit is contained in:
@@ -112,7 +112,7 @@ function createCodexAuthProfileHarness(params: { startMethod: "thread/start" | "
|
||||
seenAuthProfileIds,
|
||||
seenAgentDirs,
|
||||
async waitForMethod(method: string) {
|
||||
await vi.waitFor(() => expect(requests.some((entry) => entry.method === method)).toBe(true), {
|
||||
await vi.waitFor(() => expect(requests.map((entry) => entry.method)).toContain(method), {
|
||||
interval: 1,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -394,7 +394,7 @@ describe("Codex plugin thread config", () => {
|
||||
expect(request.mock.calls.filter(([method]) => method === "app/list").length).toBeGreaterThan(
|
||||
0,
|
||||
);
|
||||
expect(appListParams.some((params) => params.forceRefetch)).toBe(true);
|
||||
expect(appListParams.map((params) => params.forceRefetch)).toContain(true);
|
||||
});
|
||||
|
||||
it("surfaces critical post-install refresh failures and keeps plugin apps disabled", async () => {
|
||||
|
||||
@@ -147,7 +147,7 @@ function createStartedThreadHarness(
|
||||
return {
|
||||
requests,
|
||||
async waitForMethod(method: string) {
|
||||
await vi.waitFor(() => expect(requests.some((entry) => entry.method === method)).toBe(true), {
|
||||
await vi.waitFor(() => expect(requests.map((entry) => entry.method)).toContain(method), {
|
||||
interval: 1,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1878,7 +1878,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
},
|
||||
]),
|
||||
);
|
||||
expect(agentEvents.some((event) => event.stream === "assistant")).toBe(false);
|
||||
expect(agentEvents.filter((event) => event.stream === "assistant")).toEqual([]);
|
||||
expect(agentEnd).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
success: false,
|
||||
@@ -1982,13 +1982,12 @@ describe("runCodexAppServerAttempt", () => {
|
||||
await waitForMethod("turn/start");
|
||||
|
||||
expect(queueAgentHarnessMessage("session-1", "more context", { debounceMs: 1 })).toBe(true);
|
||||
await vi.waitFor(
|
||||
() => expect(requests.some((entry) => entry.method === "turn/steer")).toBe(true),
|
||||
{ interval: 1 },
|
||||
);
|
||||
await vi.waitFor(() => expect(requests.map((entry) => entry.method)).toContain("turn/steer"), {
|
||||
interval: 1,
|
||||
});
|
||||
expect(abortAgentHarnessRun("session-1")).toBe(true);
|
||||
await vi.waitFor(
|
||||
() => expect(requests.some((entry) => entry.method === "turn/interrupt")).toBe(true),
|
||||
() => expect(requests.map((entry) => entry.method)).toContain("turn/interrupt"),
|
||||
{ interval: 1 },
|
||||
);
|
||||
|
||||
@@ -2164,7 +2163,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
params.onBlockReply = vi.fn();
|
||||
const run = runCodexAppServerAttempt(params);
|
||||
await vi.waitFor(
|
||||
() => expect(request.mock.calls.some(([method]) => method === "turn/start")).toBe(true),
|
||||
() => expect(request.mock.calls.map(([method]) => method)).toContain("turn/start"),
|
||||
{ interval: 1 },
|
||||
);
|
||||
await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
|
||||
@@ -2409,7 +2408,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
};
|
||||
const run = runCodexAppServerAttempt(params);
|
||||
await vi.waitFor(() =>
|
||||
expect(request.mock.calls.some(([method]) => method === "turn/start")).toBe(true),
|
||||
expect(request.mock.calls.map(([method]) => method)).toContain("turn/start"),
|
||||
);
|
||||
await notify({
|
||||
method: "turn/completed",
|
||||
|
||||
Reference in New Issue
Block a user