test: tighten openshell backend assertion

This commit is contained in:
Shakker
2026-05-11 10:14:37 +01:00
parent 313ce2c18c
commit 1c484d4303

View File

@@ -493,9 +493,14 @@ describe("openshell sandbox backend e2e", () => {
}
await bridge.writeFile({ filePath: "nested/remote-only.txt", data: "hello-remote\n" });
await expect(
fs.readFile(path.join(workspaceDir, "nested", "remote-only.txt"), "utf8"),
).rejects.toMatchObject({ code: "ENOENT" });
const hostReadError = await fs
.readFile(path.join(workspaceDir, "nested", "remote-only.txt"), "utf8")
.then(
() => undefined,
(error: unknown) => error,
);
expect(hostReadError).toBeInstanceOf(Error);
expect((hostReadError as NodeJS.ErrnoException).code).toBe("ENOENT");
await expect(bridge.readFile({ filePath: "nested/remote-only.txt" })).resolves.toEqual(
Buffer.from("hello-remote\n"),
);