test: clarify config io assertions · openclaw/openclaw@5989a9a
steipete
·
2026-05-08
·
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.some((entry) => entry.startsWith("openclaw.json.clobbered."))).toBe(false); |
| 27 | +expect(entries.filter((entry) => entry.startsWith("openclaw.json.clobbered."))).toEqual([]); |
28 | 28 | }); |
29 | 29 | }); |
30 | 30 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -42,7 +42,7 @@ describe("config io EACCES handling", () => {
|
42 | 42 | expect(snapshot.issues[0].message).toContain("chown"); |
43 | 43 | expect(snapshot.issues[0].message).toContain(configPath); |
44 | 44 | // Should also emit to the logger |
45 | | -expect(errors.some((e) => e.includes("chown"))).toBe(true); |
| 45 | +expect(errors).toEqual(expect.arrayContaining([expect.stringContaining("chown")])); |
46 | 46 | }); |
47 | 47 | |
48 | 48 | it("includes configPath in the chown hint for the correct remediation command", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -741,7 +741,7 @@ describe("config io write", () => {
|
741 | 741 | ]); |
742 | 742 | await expect(fs.readFile(configPath, "utf-8")).resolves.toBe(cleanRaw); |
743 | 743 | const entries = await fs.readdir(path.dirname(configPath)); |
744 | | -expect(entries.some((entry) => entry.includes(".clobbered."))).toBe(true); |
| 744 | +expect(entries.filter((entry) => entry.includes(".clobbered."))).toHaveLength(1); |
745 | 745 | expect(warn).toHaveBeenCalledWith( |
746 | 746 | expect.stringContaining("Config auto-stripped non-JSON prefix:"), |
747 | 747 | ); |
@@ -830,7 +830,7 @@ describe("config io write", () => {
|
830 | 830 | |
831 | 831 | await expect(fs.readFile(configPath, "utf-8")).resolves.toBe(originalRaw); |
832 | 832 | const entries = await fs.readdir(path.dirname(configPath)); |
833 | | -expect(entries.some((entry) => entry.includes(".rejected."))).toBe(true); |
| 833 | +expect(entries.filter((entry) => entry.includes(".rejected."))).toHaveLength(1); |
834 | 834 | expect(warn).toHaveBeenCalledWith(expect.stringContaining("Config write rejected:")); |
835 | 835 | }); |
836 | 836 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。