test: tighten sandbox policy assertions · openclaw/openclaw@c6f2fa5
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ describe("sanitizeEnvVars", () => {
|
14 | 14 | NODE_ENV: "test", |
15 | 15 | FOO: "bar", |
16 | 16 | }); |
17 | | -expect(result.blocked).toEqual(expect.arrayContaining(["OPENAI_API_KEY", "GITHUB_TOKEN"])); |
| 17 | +expect(result.blocked).toStrictEqual(["OPENAI_API_KEY", "GITHUB_TOKEN"]); |
18 | 18 | }); |
19 | 19 | |
20 | 20 | it("blocks credentials even when suffix pattern matches", () => { |
@@ -25,7 +25,7 @@ describe("sanitizeEnvVars", () => {
|
25 | 25 | }); |
26 | 26 | |
27 | 27 | expect(result.allowed).toEqual({ USER: "alice" }); |
28 | | -expect(result.blocked).toEqual(expect.arrayContaining(["MY_TOKEN", "MY_SECRET"])); |
| 28 | +expect(result.blocked).toStrictEqual(["MY_TOKEN", "MY_SECRET"]); |
29 | 29 | }); |
30 | 30 | |
31 | 31 | it("adds warnings for suspicious values", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -137,14 +137,18 @@ describe("sandbox/tool-policy", () => {
|
137 | 137 | }; |
138 | 138 | |
139 | 139 | const sandbox = resolveSandboxConfigForAgent(cfg, "tavern"); |
140 | | -expect(sandbox.tools.allow).toEqual(expect.arrayContaining(["browser", "message", "tts"])); |
| 140 | +expect(sandbox.tools.allow).toContain("browser"); |
| 141 | +expect(sandbox.tools.allow).toContain("message"); |
| 142 | +expect(sandbox.tools.allow).toContain("tts"); |
141 | 143 | expect(sandbox.tools.deny).not.toContain("browser"); |
142 | 144 | |
143 | 145 | const runtime = resolveSandboxRuntimeStatus({ |
144 | 146 | cfg, |
145 | 147 | sessionKey: "agent:tavern:main", |
146 | 148 | }); |
147 | | -expect(runtime.toolPolicy.allow).toEqual(expect.arrayContaining(["browser", "message", "tts"])); |
| 149 | +expect(runtime.toolPolicy.allow).toContain("browser"); |
| 150 | +expect(runtime.toolPolicy.allow).toContain("message"); |
| 151 | +expect(runtime.toolPolicy.allow).toContain("tts"); |
148 | 152 | expect(runtime.toolPolicy.deny).not.toContain("browser"); |
149 | 153 | }); |
150 | 154 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。