test: avoid core filter allocation assertions · openclaw/openclaw@b2808ac
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ describe("readBestEffortConfig", () => {
|
24 | 24 | expect(snapshot.sourceConfig).toEqual({ update: { channel: "beta" } }); |
25 | 25 | expect(await fs.readFile(configPath, "utf-8")).toBe(directEditRaw); |
26 | 26 | const entries = await fs.readdir(`${home}/.openclaw`); |
27 | | -expect(entries.filter((entry) => entry.startsWith("openclaw.json.clobbered."))).toEqual([]); |
| 27 | +expect(entries.some((entry) => entry.startsWith("openclaw.json.clobbered."))).toBe(false); |
28 | 28 | }); |
29 | 29 | }); |
30 | 30 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -325,7 +325,7 @@ describe("commands.list handler", () => {
|
325 | 325 | it("omits plugin commands when provider lacks nativeCommandsAutoEnabled", () => { |
326 | 326 | const { payload } = callHandler({ provider: "whatsapp" }); |
327 | 327 | const { commands } = payload as { commands: Array<{ name: string; source: string }> }; |
328 | | -expect(commands.filter((c) => c.source === "plugin")).toEqual([]); |
| 328 | +expect(commands.some((c) => c.source === "plugin")).toBe(false); |
329 | 329 | }); |
330 | 330 | |
331 | 331 | it("uses text-surface names when scope=text even with provider-native aliases", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -95,7 +95,7 @@ describe("tools.catalog handler", () => {
|
95 | 95 | | undefined; |
96 | 96 | expect(payload?.agentId).toBe("main"); |
97 | 97 | const groups = payload?.groups ?? []; |
98 | | -expect(groups.filter((group) => group.source === "plugin")).toEqual([]); |
| 98 | +expect(groups.some((group) => group.source === "plugin")).toBe(false); |
99 | 99 | const media = groups.find((group) => group.id === "media"); |
100 | 100 | expect(media?.tools.map((tool) => `${tool.source}:${tool.id}`) ?? []).toContain("core:tts"); |
101 | 101 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -233,7 +233,7 @@ describe("sending", () => {
|
233 | 233 | const results = await broadcastWebPush({ title: "Broadcast" }, tmpDir); |
234 | 234 | |
235 | 235 | expect(results).toHaveLength(2); |
236 | | -expect(results.filter((result) => !result.ok)).toEqual([]); |
| 236 | +expect(results.every((result) => result.ok)).toBe(true); |
237 | 237 | expect(vi.mocked(webPush.setVapidDetails)).toHaveBeenCalledTimes(1); |
238 | 238 | expect(vi.mocked(webPush.sendNotification)).toHaveBeenCalledTimes(2); |
239 | 239 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ describe("renderMarkdownIRChunksWithinLimit", () => {
|
31 | 31 | |
32 | 32 | expect(chunks.map((chunk) => chunk.source.text)).toEqual(["alpha ", "<<"]); |
33 | 33 | expect(chunks.map((chunk) => chunk.source.text).join("")).toBe("alpha <<"); |
34 | | -expect(chunks.filter((chunk) => chunk.rendered.length > 8)).toEqual([]); |
| 34 | +expect(chunks.every((chunk) => chunk.rendered.length <= 8)).toBe(true); |
35 | 35 | }); |
36 | 36 | |
37 | 37 | it("preserves formatting when a rendered chunk is re-split", () => { |
@@ -46,8 +46,8 @@ describe("renderMarkdownIRChunksWithinLimit", () => {
|
46 | 46 | }); |
47 | 47 | |
48 | 48 | expect(chunks.map((chunk) => chunk.source.text)).toEqual(["Which of ", "these"]); |
49 | | -expect(chunks.filter((chunk) => !chunk.rendered.startsWith("<b>"))).toEqual([]); |
50 | | -expect(chunks.filter((chunk) => !chunk.rendered.endsWith("</b>"))).toEqual([]); |
| 49 | +expect(chunks.every((chunk) => chunk.rendered.startsWith("<b>"))).toBe(true); |
| 50 | +expect(chunks.every((chunk) => chunk.rendered.endsWith("</b>"))).toBe(true); |
51 | 51 | }); |
52 | 52 | |
53 | 53 | it("checks exact candidates instead of assuming rendered length is monotonic", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。