The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { hasNodejsCompat, sanitizePath } from "../utils.ts"; |
| 3 | |
| 4 | describe("utils", () => { |
| 5 | describe("sanitizePath", () => { |
| 6 | it("strips query strings", () => { |
| 7 | expect(sanitizePath("/tmp/example.wasm?init")).toBe("/tmp/example.wasm"); |
| 8 | expect(sanitizePath("/tmp/example.wasm?module")).toBe("/tmp/example.wasm"); |
| 9 | }); |
| 10 | |
| 11 | it("strips hashes", () => { |
| 12 | expect(sanitizePath("/tmp/example.wasm#fragment")).toBe("/tmp/example.wasm"); |
| 13 | expect(sanitizePath("/tmp/example.wasm?init#fragment")).toBe("/tmp/example.wasm"); |
| 14 | }); |
| 15 | }); |
| 16 | |
| 17 | describe("hasNodejsCompat", () => { |
| 18 | it("detects nodejs_compat", () => { |
| 19 | expect(hasNodejsCompat(["nodejs_compat"])).toBe(true); |
| 20 | }); |
| 21 | |
| 22 | it("detects nodejs_compat_v2", () => { |
| 23 | expect(hasNodejsCompat(["nodejs_compat_v2"])).toBe(true); |
| 24 | }); |
| 25 | |
| 26 | it("detects Node.js compatibility enabled by date", () => { |
| 27 | expect(hasNodejsCompat(undefined, "2026-08-31")).toBe(true); |
| 28 | }); |
| 29 | |
| 30 | it("honors an explicit opt-out on a default-on date", () => { |
| 31 | expect(hasNodejsCompat(["no_nodejs_compat"], "2026-08-31")).toBe(false); |
| 32 | }); |
| 33 | |
| 34 | it("returns false without compatibility flags", () => { |
| 35 | expect(hasNodejsCompat()).toBe(false); |
| 36 | expect(hasNodejsCompat(["durable_object_alarms"])).toBe(false); |
| 37 | }); |
| 38 | }); |
| 39 | }); |