test: tighten gateway id assertions

This commit is contained in:
Peter Steinberger
2026-05-08 14:39:02 +01:00
parent ad52612008
commit 1a34ef4516
4 changed files with 5 additions and 4 deletions

View File

@@ -101,7 +101,7 @@ describe("abortChatRunById", () => {
content: [{ type: "text", text: " Partial reply " }],
}),
);
expect((payload.message as { timestamp?: unknown }).timestamp).toEqual(expect.any(Number));
expect((payload.message as { timestamp?: unknown }).timestamp).toBeGreaterThan(0);
expect(ops.nodeSendToSession).toHaveBeenCalledWith(sessionKey, "chat", payload);
});

View File

@@ -141,7 +141,8 @@ describe("plugin node capability helpers", () => {
});
expect(refreshed?.surface).toBe("canvas");
expect(refreshed?.expiresAtMs).toBe(1_100);
expect(refreshed?.capability).toEqual(expect.any(String));
expect(refreshed?.capability).toBeTypeOf("string");
expect(refreshed?.capability).not.toBe("");
expect(refreshed?.scopedUrl).toContain("/__openclaw__/cap/");
expect(refreshed?.scopedUrl).not.toContain("old-token/__openclaw__/cap/");
expect(client.pluginSurfaceUrls?.canvas).toBe(refreshed?.scopedUrl);

View File

@@ -443,7 +443,7 @@ describe("gateway silent scope-upgrade reconnect", () => {
expect(res.ok).toBe(false);
expect(res.error?.message).toBe("pairing required: device is not approved yet");
expect(replacementRequestId).toEqual(expect.any(String));
expect(replacementRequestId).toBeTypeOf("string");
expect(replacementRequestId.length).toBeGreaterThan(0);
expect(
(res.error?.details as { requestId?: unknown; code?: string } | undefined)?.requestId,

View File

@@ -18,7 +18,7 @@ describe("gateway tools.catalog", () => {
}>(ws, "tools.catalog", {});
expect(res.ok).toBe(true);
expect(res.payload?.agentId).toEqual(expect.any(String));
expect(res.payload?.agentId).toBeTypeOf("string");
expect(res.payload?.agentId).not.toBe("");
const mediaGroup = res.payload?.groups?.find((group) => group.id === "media");
expect(mediaGroup?.tools?.map((tool) => `${tool.source}:${tool.id}`) ?? []).toContain(