test: tighten gateway id assertions · openclaw/openclaw@1a34ef4
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -101,7 +101,7 @@ describe("abortChatRunById", () => {
|
101 | 101 | content: [{ type: "text", text: " Partial reply " }], |
102 | 102 | }), |
103 | 103 | ); |
104 | | -expect((payload.message as { timestamp?: unknown }).timestamp).toEqual(expect.any(Number)); |
| 104 | +expect((payload.message as { timestamp?: unknown }).timestamp).toBeGreaterThan(0); |
105 | 105 | expect(ops.nodeSendToSession).toHaveBeenCalledWith(sessionKey, "chat", payload); |
106 | 106 | }); |
107 | 107 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -141,7 +141,8 @@ describe("plugin node capability helpers", () => {
|
141 | 141 | }); |
142 | 142 | expect(refreshed?.surface).toBe("canvas"); |
143 | 143 | expect(refreshed?.expiresAtMs).toBe(1_100); |
144 | | -expect(refreshed?.capability).toEqual(expect.any(String)); |
| 144 | +expect(refreshed?.capability).toBeTypeOf("string"); |
| 145 | +expect(refreshed?.capability).not.toBe(""); |
145 | 146 | expect(refreshed?.scopedUrl).toContain("/__openclaw__/cap/"); |
146 | 147 | expect(refreshed?.scopedUrl).not.toContain("old-token/__openclaw__/cap/"); |
147 | 148 | expect(client.pluginSurfaceUrls?.canvas).toBe(refreshed?.scopedUrl); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -443,7 +443,7 @@ describe("gateway silent scope-upgrade reconnect", () => {
|
443 | 443 | |
444 | 444 | expect(res.ok).toBe(false); |
445 | 445 | expect(res.error?.message).toBe("pairing required: device is not approved yet"); |
446 | | -expect(replacementRequestId).toEqual(expect.any(String)); |
| 446 | +expect(replacementRequestId).toBeTypeOf("string"); |
447 | 447 | expect(replacementRequestId.length).toBeGreaterThan(0); |
448 | 448 | expect( |
449 | 449 | (res.error?.details as { requestId?: unknown; code?: string } | undefined)?.requestId, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ describe("gateway tools.catalog", () => {
|
18 | 18 | }>(ws, "tools.catalog", {}); |
19 | 19 | |
20 | 20 | expect(res.ok).toBe(true); |
21 | | -expect(res.payload?.agentId).toEqual(expect.any(String)); |
| 21 | +expect(res.payload?.agentId).toBeTypeOf("string"); |
22 | 22 | expect(res.payload?.agentId).not.toBe(""); |
23 | 23 | const mediaGroup = res.payload?.groups?.find((group) => group.id === "media"); |
24 | 24 | expect(mediaGroup?.tools?.map((tool) => `${tool.source}:${tool.id}`) ?? []).toContain( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。