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:
33
packages/engine/src/sandbox/__tests__/types.test.ts
Normal file
33
packages/engine/src/sandbox/__tests__/types.test.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user