feat(FN-4636): complete Step 1 — define sandbox backend interface

Fusion-Task-Id: FN-4636
Fusion-Task-Lineage: 38ff2f48-4cb1-42c2-8f64-eb3b8d3d7f2c
This commit is contained in:
Fusion
2026-05-15 10:00:00 -07:00
committed by gsxdsm
parent 9e87de0e8e
commit 92be0b4217
2 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { describe, expect, it } from "vitest";
import type { SandboxBackend, SandboxCapabilities, SandboxPolicy, SandboxRunOptions, SandboxRunResult } from "../types.js";
describe("SandboxBackend types", () => {
it("accepts a minimal mock backend", async () => {
const backend: SandboxBackend = {
capabilities(): SandboxCapabilities {
return {
id: "native",
supportsNetworkPolicy: false,
supportsFilesystemPolicy: false,
platform: "any",
};
},
async prepare(_policy: SandboxPolicy): Promise<void> {},
async run(_command: string, _options: SandboxRunOptions): Promise<SandboxRunResult> {
return {
stdout: "",
stderr: "",
exitCode: 0,
signal: null,
timedOut: false,
bufferExceeded: false,
};
},
async dispose(): Promise<void> {},
};
await expect(backend.prepare({ allowNetwork: true })).resolves.toBeUndefined();
await expect(backend.dispose()).resolves.toBeUndefined();
});
});