test: tighten sandbox agent config assertions · openclaw/openclaw@6c7d46f
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -158,9 +158,10 @@ describe("Agent-specific sandbox config", () => {
|
158 | 158 | |
159 | 159 | const context = await resolveContext(cfg, "agent:isolated:main", "/tmp/test-isolated"); |
160 | 160 | |
161 | | -expect(context).toMatchObject({ |
162 | | -workspaceDir: expect.stringContaining(path.resolve("/tmp/isolated-sandboxes")), |
163 | | -}); |
| 161 | +if (!context) { |
| 162 | +throw new Error("Expected sandbox context for isolated agent"); |
| 163 | +} |
| 164 | +expect(context.workspaceDir).toContain(path.resolve("/tmp/isolated-sandboxes")); |
164 | 165 | }); |
165 | 166 | |
166 | 167 | it("should prefer agent config over global for multiple agents", () => { |
@@ -268,10 +269,11 @@ describe("Agent-specific sandbox config", () => {
|
268 | 269 | const cfg = createWorkSetupCommandConfig(scenario.scope); |
269 | 270 | const context = await resolveContext(cfg, "agent:work:main", "/tmp/test-work"); |
270 | 271 | |
271 | | -expect(context).toMatchObject({ |
272 | | -docker: { setupCommand: scenario.expectedSetup }, |
273 | | -containerName: expect.stringContaining(scenario.expectedContainerFragment), |
274 | | -}); |
| 272 | +if (!context) { |
| 273 | +throw new Error(`Expected sandbox context for ${scenario.scope} scoped setup`); |
| 274 | +} |
| 275 | +expect(context.docker?.setupCommand).toBe(scenario.expectedSetup); |
| 276 | +expect(context.containerName).toContain(scenario.expectedContainerFragment); |
275 | 277 | expectDockerSetupCommand(scenario.expectedSetup); |
276 | 278 | spawnCalls.length = 0; |
277 | 279 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。