Skip to content

Commit

Permalink
test: add a failing case (mapped jsr with path)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed May 8, 2024
1 parent e9bead5 commit fb45d48
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/import_map_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ Deno.test("resolveInner", async () => {
const { resolveInner } = await readFromJson(
new URL("../test/cases/import_map/deno.json", import.meta.url),
);
const referrer = new URL("../test/cases/import_map/mod.ts", import.meta.url);
assertEquals(
resolveInner(
"/lib.ts",
new URL("../test/cases/import_map/mod.ts", import.meta.url),
),
resolveInner("/lib.ts", referrer),
new URL("../test/cases/import_map/lib.ts", import.meta.url).href,
);
assertEquals(
resolveInner("@std/testing/bdd", referrer),
"jsr:/@std/testing@0.200.0/bdd",
);
});
5 changes: 5 additions & 0 deletions test/cases/jsr_with_path_in_import_map/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@std/testing": "jsr:@std/testing@0.210.0"
}
}
1 change: 1 addition & 0 deletions test/cases/jsr_with_path_in_import_map/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { describe } from "@std/testing/bdd";
23 changes: 23 additions & 0 deletions test/snapshots/update_test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,29 @@ snapshot[`collect - lockfile_not_importable - mod.ts 2`] = `
]
`;

snapshot[`collect - jsr_with_path_in_import_map - deno.json 1`] = `
[
{
code: {
span: undefined,
specifier: "jsr:@std/testing@0.210.0",
},
from: {
name: "@std/testing",
path: "",
protocol: "jsr:",
version: "0.210.0",
},
to: {
name: "@std/testing",
path: "",
protocol: "jsr:",
version: "123.456.789",
},
},
]
`;

snapshot[`collect - multiple_imports.ts 1`] = `
[
{
Expand Down

0 comments on commit fb45d48

Please sign in to comment.