summaryrefslogtreecommitdiffhomepage
path: root/packages/shared/test/npm.test.ts
diff options
context:
space:
mode:
authorShoubhit Dash <[email protected]>2026-04-16 17:30:14 +0530
committerShoubhit Dash <[email protected]>2026-04-16 17:30:14 +0530
commit2e18a603f0ea24154908e748493fd4bfaa74fc00 (patch)
treeb723e00af2821b213573b16fa199b64babd5f1f5 /packages/shared/test/npm.test.ts
parent9819eb04614fd607cacb07d754052f1531a82331 (diff)
parent7341718f9234b0cf3a8758c87e91d2006b71bff6 (diff)
downloadopencode-2e18a603f0ea24154908e748493fd4bfaa74fc00.tar.gz
opencode-2e18a603f0ea24154908e748493fd4bfaa74fc00.zip
merge dev
Diffstat (limited to 'packages/shared/test/npm.test.ts')
-rw-r--r--packages/shared/test/npm.test.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/shared/test/npm.test.ts b/packages/shared/test/npm.test.ts
new file mode 100644
index 000000000..4443d2985
--- /dev/null
+++ b/packages/shared/test/npm.test.ts
@@ -0,0 +1,18 @@
+import { describe, expect, test } from "bun:test"
+import { Npm } from "@opencode-ai/shared/npm"
+
+const win = process.platform === "win32"
+
+describe("Npm.sanitize", () => {
+ test("keeps normal scoped package specs unchanged", () => {
+ expect(Npm.sanitize("@opencode/acme")).toBe("@opencode/acme")
+ expect(Npm.sanitize("@opencode/[email protected]")).toBe("@opencode/[email protected]")
+ expect(Npm.sanitize("prettier")).toBe("prettier")
+ })
+
+ test("handles git https specs", () => {
+ const spec = "acme@git+https://github.com/opencode/acme.git"
+ const expected = win ? "acme@git+https_//github.com/opencode/acme.git" : spec
+ expect(Npm.sanitize(spec)).toBe(expected)
+ })
+})