test: tighten agent helper array assertions · openclaw/openclaw@90ab12c
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -187,7 +187,7 @@ describe("resolveAuthProfileOrder", () => {
|
187 | 187 | provider: "fixture-provider", |
188 | 188 | }); |
189 | 189 | |
190 | | -expect(order).toEqual([]); |
| 190 | +expect(order).toStrictEqual([]); |
191 | 191 | }); |
192 | 192 | |
193 | 193 | it("keeps explicit empty stored auth order as a provider disable", async () => { |
@@ -218,7 +218,7 @@ describe("resolveAuthProfileOrder", () => {
|
218 | 218 | provider: "fixture-provider", |
219 | 219 | }); |
220 | 220 | |
221 | | -expect(order).toEqual([]); |
| 221 | +expect(order).toStrictEqual([]); |
222 | 222 | }); |
223 | 223 | |
224 | 224 | it("marks aliased provider profiles good under the canonical auth provider", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -164,7 +164,7 @@ async function expectBackgroundSessionSurvivesAbort(params: {
|
164 | 164 | const running = getSession(sessionId); |
165 | 165 | const finished = getFinishedSession(sessionId); |
166 | 166 | try { |
167 | | -expect(supervisorMockState.cancelReasons).toEqual([]); |
| 167 | +expect(supervisorMockState.cancelReasons).toStrictEqual([]); |
168 | 168 | expect(finished).toBeUndefined(); |
169 | 169 | expect(running?.exited).toBe(false); |
170 | 170 | } finally { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,7 +29,7 @@ describe("resolveSandboxWorkdir", () => {
|
29 | 29 | |
30 | 30 | expect(resolved.hostWorkdir).toBe(workspaceDir); |
31 | 31 | expect(resolved.containerWorkdir).toBe("/workspace"); |
32 | | -expect(warnings).toEqual([]); |
| 32 | +expect(warnings).toStrictEqual([]); |
33 | 33 | }); |
34 | 34 | }); |
35 | 35 | |
@@ -50,7 +50,7 @@ describe("resolveSandboxWorkdir", () => {
|
50 | 50 | |
51 | 51 | expect(resolved.hostWorkdir).toBe(nested); |
52 | 52 | expect(resolved.containerWorkdir).toBe("/workspace/scripts/runner"); |
53 | | -expect(warnings).toEqual([]); |
| 53 | +expect(warnings).toStrictEqual([]); |
54 | 54 | }); |
55 | 55 | }); |
56 | 56 | |
@@ -71,7 +71,7 @@ describe("resolveSandboxWorkdir", () => {
|
71 | 71 | |
72 | 72 | expect(resolved.hostWorkdir).toBe(nested); |
73 | 73 | expect(resolved.containerWorkdir).toBe("/sandbox-root/project"); |
74 | | -expect(warnings).toEqual([]); |
| 74 | +expect(warnings).toStrictEqual([]); |
75 | 75 | }); |
76 | 76 | }); |
77 | 77 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -187,7 +187,7 @@ describe("resolveBootstrapContextForRun", () => {
|
187 | 187 | |
188 | 188 | expect(files.length).toBeGreaterThan(0); |
189 | 189 | const nonHeartbeatFiles = files.filter((file) => file.name !== "HEARTBEAT.md"); |
190 | | -expect(nonHeartbeatFiles).toEqual([]); |
| 190 | +expect(nonHeartbeatFiles).toStrictEqual([]); |
191 | 191 | }); |
192 | 192 | |
193 | 193 | it("keeps bootstrap context empty in lightweight cron mode", async () => { |
@@ -200,7 +200,7 @@ describe("resolveBootstrapContextForRun", () => {
|
200 | 200 | runKind: "cron", |
201 | 201 | }); |
202 | 202 | |
203 | | -expect(files).toEqual([]); |
| 203 | +expect(files).toStrictEqual([]); |
204 | 204 | }); |
205 | 205 | |
206 | 206 | it("drops HEARTBEAT.md for non-heartbeat runs when the heartbeat prompt section is disabled", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -264,7 +264,7 @@ describe("pruneHistoryForContextShare", () => {
|
264 | 264 | expect(pruned.droppedChunks).toBe(0); |
265 | 265 | expect(pruned.messages.length).toBe(messages.length); |
266 | 266 | expect(pruned.keptTokens).toBe(estimateMessagesTokens(messages)); |
267 | | -expect(pruned.droppedMessagesList).toEqual([]); |
| 267 | +expect(pruned.droppedMessagesList).toStrictEqual([]); |
268 | 268 | }); |
269 | 269 | |
270 | 270 | it("returns droppedMessagesList containing dropped messages", () => { |
@@ -291,7 +291,7 @@ describe("pruneHistoryForContextShare", () => {
|
291 | 291 | }); |
292 | 292 | |
293 | 293 | expect(pruned.droppedChunks).toBe(0); |
294 | | -expect(pruned.droppedMessagesList).toEqual([]); |
| 294 | +expect(pruned.droppedMessagesList).toStrictEqual([]); |
295 | 295 | expect(pruned.messages.length).toBe(1); |
296 | 296 | }); |
297 | 297 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1336,7 +1336,7 @@ describe("sessions tools", () => {
|
1336 | 1336 | "Agent-to-agent reply step", |
1337 | 1337 | ), |
1338 | 1338 | ); |
1339 | | -expect(replyPromptAgentCalls).toEqual([]); |
| 1339 | +expect(replyPromptAgentCalls).toStrictEqual([]); |
1340 | 1340 | expect(calls.some((call) => call.method === "send")).toBe(false); |
1341 | 1341 | }); |
1342 | 1342 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -467,7 +467,7 @@ describe("session MCP runtime", () => {
|
467 | 467 | await expect(manager.sweepIdleRuntimes()).resolves.toBe(1); |
468 | 468 | |
469 | 469 | expect(disposed).toEqual(["session-idle"]); |
470 | | -expect(manager.listSessionIds()).toEqual([]); |
| 470 | +expect(manager.listSessionIds()).toStrictEqual([]); |
471 | 471 | expect(manager.resolveSessionId("agent:test:session-idle")).toBeUndefined(); |
472 | 472 | }); |
473 | 473 | |
@@ -498,6 +498,6 @@ describe("session MCP runtime", () => {
|
498 | 498 | now += 60_000_000; |
499 | 499 | await expect(manager.sweepIdleRuntimes()).resolves.toBe(0); |
500 | 500 | expect(manager.listSessionIds()).toEqual(["session-no-ttl"]); |
501 | | -expect(disposed).toEqual([]); |
| 501 | +expect(disposed).toStrictEqual([]); |
502 | 502 | }); |
503 | 503 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -57,7 +57,7 @@ describe("buildBootstrapContextFiles", () => {
|
57 | 57 | }); |
58 | 58 | it("skips empty or whitespace-only content", () => { |
59 | 59 | const files = [makeFile({ content: " \n " })]; |
60 | | -expect(buildBootstrapContextFiles(files)).toEqual([]); |
| 60 | +expect(buildBootstrapContextFiles(files)).toStrictEqual([]); |
61 | 61 | }); |
62 | 62 | it("truncates large bootstrap content", () => { |
63 | 63 | const head = `HEAD-${"a".repeat(600)}`; |
@@ -178,7 +178,7 @@ describe("buildBootstrapContextFiles", () => {
|
178 | 178 | maxChars: 200, |
179 | 179 | totalMaxChars: 40, |
180 | 180 | }); |
181 | | -expect(result).toEqual([]); |
| 181 | +expect(result).toStrictEqual([]); |
182 | 182 | }); |
183 | 183 | |
184 | 184 | it("keeps missing markers under small total budgets", () => { |
@@ -222,7 +222,7 @@ describe("buildBootstrapContextFiles", () => {
|
222 | 222 | expect(warnings).toHaveLength(3); |
223 | 223 | expect( |
224 | 224 | warnings.filter((warning) => !warning.includes('missing or invalid "path" field')), |
225 | | -).toEqual([]); |
| 225 | +).toStrictEqual([]); |
226 | 226 | }); |
227 | 227 | }); |
228 | 228 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -506,7 +506,7 @@ describe("stripThoughtSignatures", () => {
|
506 | 506 | ]); |
507 | 507 | }); |
508 | 508 | it("handles empty array", () => { |
509 | | -expect(stripThoughtSignatures([])).toEqual([]); |
| 509 | +expect(stripThoughtSignatures([])).toStrictEqual([]); |
510 | 510 | }); |
511 | 511 | it("handles null/undefined blocks in array", () => { |
512 | 512 | const input = [null, undefined, { type: "text", text: "hello" }]; |
@@ -638,7 +638,7 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
638 | 638 | }, |
639 | 639 | ]; |
640 | 640 | |
641 | | -expect(downgradeOpenAIReasoningBlocks(input as any)).toEqual([]); |
| 641 | +expect(downgradeOpenAIReasoningBlocks(input as any)).toStrictEqual([]); |
642 | 642 | }); |
643 | 643 | |
644 | 644 | it("keeps non-reasoning thinking signatures", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -940,7 +940,7 @@ describe("sanitizeSessionHistory", () => {
|
940 | 940 | allowedToolNames: ["read"], |
941 | 941 | }); |
942 | 942 | |
943 | | -expect(result).toEqual([]); |
| 943 | +expect(result).toStrictEqual([]); |
944 | 944 | }); |
945 | 945 | |
946 | 946 | it("downgrades orphaned openai reasoning even when the model has not changed", async () => { |
@@ -961,7 +961,7 @@ describe("sanitizeSessionHistory", () => {
|
961 | 961 | sessionManager, |
962 | 962 | }); |
963 | 963 | |
964 | | -expect(result).toEqual([]); |
| 964 | +expect(result).toStrictEqual([]); |
965 | 965 | }); |
966 | 966 | |
967 | 967 | it("downgrades orphaned openai reasoning when the model changes too", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。