|
1 | 1 | // File Transfer tests cover errors plugin behavior. |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | | -import { classifyFsError, err, throwFromNodePayload } from "./errors.js"; |
| 3 | +import { err, throwFromNodePayload } from "./errors.js"; |
4 | 4 | |
5 | 5 | describe("err", () => { |
6 | 6 | it("returns an error envelope without canonicalPath when omitted", () => { |
@@ -18,28 +18,6 @@ describe("err", () => {
|
18 | 18 | }); |
19 | 19 | }); |
20 | 20 | |
21 | | -describe("classifyFsError", () => { |
22 | | -it("maps ENOENT to NOT_FOUND", () => { |
23 | | -expect(classifyFsError({ code: "ENOENT" })).toBe("NOT_FOUND"); |
24 | | -}); |
25 | | - |
26 | | -it("maps EACCES and EPERM to PERMISSION_DENIED", () => { |
27 | | -expect(classifyFsError({ code: "EACCES" })).toBe("PERMISSION_DENIED"); |
28 | | -expect(classifyFsError({ code: "EPERM" })).toBe("PERMISSION_DENIED"); |
29 | | -}); |
30 | | - |
31 | | -it("maps EISDIR to IS_DIRECTORY", () => { |
32 | | -expect(classifyFsError({ code: "EISDIR" })).toBe("IS_DIRECTORY"); |
33 | | -}); |
34 | | - |
35 | | -it("falls back to READ_ERROR for unknown / null / non-object input", () => { |
36 | | -expect(classifyFsError({ code: "EUNKNOWN" })).toBe("READ_ERROR"); |
37 | | -expect(classifyFsError(null)).toBe("READ_ERROR"); |
38 | | -expect(classifyFsError(undefined)).toBe("READ_ERROR"); |
39 | | -expect(classifyFsError("nope")).toBe("READ_ERROR"); |
40 | | -}); |
41 | | -}); |
42 | | - |
43 | 21 | describe("throwFromNodePayload", () => { |
44 | 22 | it("preserves code and message in the thrown Error", () => { |
45 | 23 | expect(() => |
|