test: tighten nullable agent helper assertions · openclaw/openclaw@a6313f6
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -71,7 +71,8 @@ describe("buildBootstrapContextFiles", () => {
|
71 | 71 | warn: (message) => warnings.push(message), |
72 | 72 | }); |
73 | 73 | const kept = result?.content.match(/kept (\d+)\+(\d+) chars/); |
74 | | -expect(kept).not.toBeNull(); |
| 74 | +expect(kept?.[1]).toEqual(expect.any(String)); |
| 75 | +expect(kept?.[2]).toEqual(expect.any(String)); |
75 | 76 | if (!kept) { |
76 | 77 | throw new Error("missing truncation kept-count marker"); |
77 | 78 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -322,7 +322,10 @@ describe("resolveSandboxContext", () => {
|
322 | 322 | workspaceDir, |
323 | 323 | }); |
324 | 324 | |
325 | | -expect(result).not.toBeNull(); |
| 325 | +expect(result).toMatchObject({ workspaceDir: expect.any(String) }); |
| 326 | +if (!result) { |
| 327 | +throw new Error("expected sandbox workspace resolution"); |
| 328 | +} |
326 | 329 | expect(syncSkillsToWorkspaceMock).toHaveBeenCalledWith( |
327 | 330 | expect.objectContaining({ |
328 | 331 | sourceWorkspaceDir: workspaceDir, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -36,7 +36,6 @@ describe("decodeStrictBase64", () => {
|
36 | 36 | const input = "hello world"; |
37 | 37 | const encoded = Buffer.from(input).toString("base64"); |
38 | 38 | const result = decodeStrictBase64(encoded, maxBytes); |
39 | | -expect(result).not.toBeNull(); |
40 | 39 | expect(result?.toString("utf8")).toBe(input); |
41 | 40 | }); |
42 | 41 | |
@@ -79,7 +78,6 @@ describe("decodeStrictBase64", () => {
|
79 | 78 | const exactBuf = Buffer.alloc(1024, 0x41); |
80 | 79 | const encoded = exactBuf.toString("base64"); |
81 | 80 | const result = decodeStrictBase64(encoded, maxBytes); |
82 | | -expect(result).not.toBeNull(); |
83 | 81 | expect(result?.byteLength).toBe(1024); |
84 | 82 | }); |
85 | 83 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。