History

Use tagged workspace read errors

Cursor Agent committed 4 months ago

Commit 7f891481 parent 05760162 files · +75 −8Browse files

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

Unified · Split

apps/server/src/workspace/WorkspaceFileSystem.test.ts+13−4
@@ -137,8 +137,14 @@ it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (i · 136 unmodified lines
137137 error.message,
138138 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'image.bin' in '${cwd}'.`,
139139 );
140− assert.ok(error.cause instanceof Error);
141− assert.strictEqual((error.cause as Error).message, "Binary files cannot be previewed as text.");
140+ assert.strictEqual(
141+ (error.cause as { readonly _tag?: string })._tag,
142+ "WorkspaceReadFileBinaryFileError",
143+ );
144+ assert.strictEqual(
145+ (error.cause as { readonly message?: string }).message,
146+ "Binary files cannot be previewed as text.",
147+ );
142148 }),
143149 );
144150
@@ -163,9 +169,12 @@ it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (i · 18 unmodified lines
163169 error.message,
164170 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'linked-secret.txt' in '${cwd}'.`,
165171 );
166− assert.ok(error.cause instanceof Error);
167172 assert.strictEqual(
168− (error.cause as Error).message,
173+ (error.cause as { readonly _tag?: string })._tag,
174+ "WorkspaceReadFileResolvedOutsideRootError",
175+ );
176+ assert.strictEqual(
177+ (error.cause as { readonly message?: string }).message,
169178 "Workspace file path resolves outside the project root.",
170179 );
171180 }),