Skip to content
Source
Sign inSign up
Open History to see the last commit

BundlePaths.test.ts

27 lines918 Bytes

1import { describe, expect, it } from "@alchemy.run/test";
2import * as Effect from "effect/Effect";
3import { normalizeBundleFilePath } from "../../../prisma/src/internal/BundlePaths.ts";
4​
5describe("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});