The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "@alchemy.run/test"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { normalizeBundleFilePath } from "../../../prisma/src/internal/BundlePaths.ts"; |
| 4 | |
| 5 | describe("Prisma Compute bundle paths", { tags: ["unit", "provider:prisma", "local"] }, () => { |
| 6 | it.effect("accepts normalized relative bundle paths", () => |
| 7 | Effect.gen(function* () { |
| 8 | expect(yield* normalizeBundleFilePath("chunks/api.js")).toBe("chunks/api.js"); |
| 9 | }), |
| 10 | ); |
| 11 | |
| 12 | it.effect("rejects empty, absolute, and traversal bundle paths", () => |
| 13 | Effect.gen(function* () { |
| 14 | for (const path of [ |
| 15 | "", |
| 16 | "/tmp/escape.js", |
| 17 | "C:\\tmp\\escape.js", |
| 18 | "../escape.js", |
| 19 | "chunks/../../escape.js", |
| 20 | "chunks//escape.js", |
| 21 | ]) { |
| 22 | const error = yield* normalizeBundleFilePath(path).pipe(Effect.flip); |
| 23 | expect(error).toBeInstanceOf(Error); |
| 24 | } |
| 25 | }), |
| 26 | ); |
| 27 | }); |