-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,16 @@ Deno.test("query as version suffix", async () => { | |
assertStringIncludes(code, "/[email protected]/es2022/client.development.js"); | ||
}); | ||
|
||
Deno.test("`/jsx-runtime` in query", async () => { | ||
const res = await fetch("http://localhost:8080/[email protected]?dev&target=es2022/jsx-runtime"); | ||
const code = await res.text(); | ||
assertEquals(res.status, 200); | ||
assertEquals(res.headers.get("cache-control"), "public, max-age=31536000, immutable"); | ||
assertEquals(res.headers.get("content-type"), "application/javascript; charset=utf-8"); | ||
assert(!res.headers.get("vary")!.includes("User-Agent")); | ||
assertStringIncludes(code, "/[email protected]/es2022/jsx-runtime.development.js"); | ||
}); | ||
|
||
Deno.test("redirect semver versioning module for deno target", async () => { | ||
"deno target"; | ||
{ | ||
|
@@ -60,7 +70,7 @@ Deno.test("redirect asset URLs", async () => { | |
assertStringIncludes(pkg4.name, "preact"); | ||
}); | ||
|
||
Deno.test("Fix wasm URLs with target segment", async () => { | ||
Deno.test("Fix wasm URLs with `target` segment", async () => { | ||
const res = await fetch( | ||
"http://localhost:8080/[email protected]/deno/lightningcss_node.wasm", | ||
{ redirect: "manual" }, | ||
|
@@ -84,7 +94,7 @@ Deno.test("Fix wasm URLs with target segment", async () => { | |
); | ||
}); | ||
|
||
Deno.test("Fix json URLs with target segment", async () => { | ||
Deno.test("Fix json URLs with `target` segment", async () => { | ||
const res = await fetch( | ||
"http://localhost:8080/[email protected]/deno/package.json", | ||
{ redirect: "manual" }, | ||
|
@@ -97,13 +107,12 @@ Deno.test("Fix json URLs with target segment", async () => { | |
); | ||
}); | ||
|
||
Deno.test("fix `/#/` path", async () => { | ||
const res = await fetch("http://localhost:8080/es5-ext@^0.10.50/string/%23/contains?target=denonext", { redirect: "manual" }); | ||
res.body?.cancel(); | ||
assertEquals(res.status, 302); | ||
assertEquals(res.headers.get("cache-control"), "public, max-age=3600"); | ||
assertStringIncludes(res.headers.get("location")!, "http://localhost:8080/[email protected]."); | ||
assertStringIncludes(res.headers.get("location")!, "/string/%23/contains"); | ||
Deno.test("support `/#/` in path", async () => { | ||
const res = await fetch("http://localhost:8080/[email protected]/string/%23/contains"); | ||
assertEquals(res.status, 200); | ||
assertEquals(res.headers.get("content-type"), "application/javascript; charset=utf-8"); | ||
assertEquals(res.headers.get("cache-control"), "public, max-age=31536000, immutable"); | ||
assertStringIncludes(await res.text(), "/denonext/string/%23/contains.js"); | ||
}); | ||
|
||
Deno.test("dts-transformer: support `.d` extension", async () => { | ||
|