

























@@ -101,35 +101,34 @@ describe("listSandboxBrowsers", () => {
101101it("compares browser runtimes against sandbox.browser.image", async () => {
102102const results = await listSandboxBrowsers();
103103104-expect(backendMocks.describeRuntime).toHaveBeenCalledWith(
105-expect.objectContaining({
106-agentId: "coder",
107-entry: expect.objectContaining({
108-configLabelKind: "BrowserImage",
109-}),
110-}),
111-);
104+const describeInput = backendMocks.describeRuntime.mock.calls[0]?.[0] as
105+| { agentId?: string; entry?: { configLabelKind?: string } }
106+| undefined;
107+expect(describeInput?.agentId).toBe("coder");
108+expect(describeInput?.entry?.configLabelKind).toBe("BrowserImage");
112109expect(results).toHaveLength(1);
113-expect(results[0]).toMatchObject({
114-image: "openclaw-sandbox-browser:bookworm-slim",
115-running: true,
116-imageMatch: true,
117-});
110+expect(results[0]?.image).toBe("openclaw-sandbox-browser:bookworm-slim");
111+expect(results[0]?.running).toBe(true);
112+expect(results[0]?.imageMatch).toBe(true);
118113});
119114120115it("removes browser runtimes with BrowserImage config label kind", async () => {
121116await removeSandboxBrowserContainer("browser-1");
122117123-expect(backendMocks.removeRuntime).toHaveBeenCalledWith(
124-expect.objectContaining({
125-entry: expect.objectContaining({
126-containerName: "browser-1",
127-configLabelKind: "BrowserImage",
128-runtimeLabel: "browser-1",
129-backendId: "docker",
130-}),
131-}),
132-);
118+const removeInput = backendMocks.removeRuntime.mock.calls[0]?.[0] as
119+| {
120+entry?: {
121+containerName?: string;
122+configLabelKind?: string;
123+runtimeLabel?: string;
124+backendId?: string;
125+};
126+}
127+| undefined;
128+expect(removeInput?.entry?.containerName).toBe("browser-1");
129+expect(removeInput?.entry?.configLabelKind).toBe("BrowserImage");
130+expect(removeInput?.entry?.runtimeLabel).toBe("browser-1");
131+expect(removeInput?.entry?.backendId).toBe("docker");
133132expect(registryMocks.removeBrowserRegistryEntry).toHaveBeenCalledWith("browser-1");
134133});
135134});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。