|
1 | 1 | // Runtime import tests cover lazy runtime import caching and failure handling. |
2 | 2 | import { afterEach, describe, expect, it, vi } from "vitest"; |
3 | | -import { |
4 | | -importRuntimeModule, |
5 | | -resolveRuntimeImportSpecifier, |
6 | | -toSafeRuntimeImportPath, |
7 | | -} from "./runtime-import.js"; |
| 3 | +import { toSafeImportPath } from "./import-specifier.js"; |
| 4 | +import { importRuntimeModule, resolveRuntimeImportSpecifier } from "./runtime-import.js"; |
8 | 5 | |
9 | 6 | describe("runtime-import", () => { |
10 | 7 | afterEach(() => { |
@@ -14,13 +11,13 @@ describe("runtime-import", () => {
|
14 | 11 | it("converts Windows absolute import specifiers to file URLs", () => { |
15 | 12 | vi.spyOn(process, "platform", "get").mockReturnValue("win32"); |
16 | 13 | |
17 | | -expect(toSafeRuntimeImportPath("C:\\Users\\alice\\plugin\\index.mjs")).toBe( |
| 14 | +expect(toSafeImportPath("C:\\Users\\alice\\plugin\\index.mjs")).toBe( |
18 | 15 | "file:///C:/Users/alice/plugin/index.mjs", |
19 | 16 | ); |
20 | | -expect(toSafeRuntimeImportPath("C:\\Users\\alice\\plugin folder\\x#y.mjs")).toBe( |
| 17 | +expect(toSafeImportPath("C:\\Users\\alice\\plugin folder\\x#y.mjs")).toBe( |
21 | 18 | "file:///C:/Users/alice/plugin%20folder/x%23y.mjs", |
22 | 19 | ); |
23 | | -expect(toSafeRuntimeImportPath("\\\\server\\share\\plugin\\index.mjs")).toBe( |
| 20 | +expect(toSafeImportPath("\\\\server\\share\\plugin\\index.mjs")).toBe( |
24 | 21 | "file://server/share/plugin/index.mjs", |
25 | 22 | ); |
26 | 23 | }); |
@@ -58,7 +55,7 @@ describe("runtime-import", () => {
|
58 | 55 | it("keeps non-Windows import paths unchanged", () => { |
59 | 56 | vi.spyOn(process, "platform", "get").mockReturnValue("linux"); |
60 | 57 | |
61 | | -expect(toSafeRuntimeImportPath("C:\\Users\\alice\\plugin\\index.mjs")).toBe( |
| 58 | +expect(toSafeImportPath("C:\\Users\\alice\\plugin\\index.mjs")).toBe( |
62 | 59 | "C:\\Users\\alice\\plugin\\index.mjs", |
63 | 60 | ); |
64 | 61 | }); |
|