History

Assert normalized filesystem platform errors

Cursor Agent committed 4 months ago

Commit 47f50251 parent 6241e151 file · +6 −2Browse files

Showing the changes to apps/server/src/workspace/WorkspaceFileSystem.test.ts (1 of 1 file). Show all

Unified · Split

apps/server/src/workspace/WorkspaceFileSystem.test.ts+6−2
@@ -1,9 +1,10 @@
11 import * as NodeServices from "@effect/platform-node/NodeServices";
2−import { it, describe, expect } from "@effect/vitest";
2+import { assert, it, describe, expect } from "@effect/vitest";
33 import * as Effect from "effect/Effect";
44 import * as FileSystem from "effect/FileSystem";
55 import * as Layer from "effect/Layer";
66 import * as Path from "effect/Path";
7+import type * as PlatformError from "effect/PlatformError";
78
89 import * as ServerConfig from "../config.ts";
910 import * as VcsDriverRegistry from "../vcs/VcsDriverRegistry.ts";
@@ -186,7 +187,10 @@ it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (i · 176 unmodified lines
186187 operation: "realpath-target",
187188 });
188189 expect(error.cause).toBeInstanceOf(Error);
189− expect((error.cause as NodeJS.ErrnoException).code).toBe("ENOENT");
190+ const cause = error.cause as PlatformError.PlatformError;
191+ assert.equal(cause._tag, "PlatformError");
192+ assert.equal(cause.reason._tag, "NotFound");
193+ assert.equal(cause.reason.pathOrDescriptor, resolvedPath);
190194 }),
191195 );
192196 });