| ... | ... | @@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test"; |
| 2 | 2 | |
| 3 | 3 | import { |
| 4 | 4 | isLoopbackHost, |
| 5 | | isPreviewableUrl, |
| 6 | 5 | newPreviewTabId, |
| 7 | 6 | normalizePreviewUrl, |
| 8 | 7 | PreviewUrlNormalizationError, |
| ... | ... | @@ -27,24 +26,6 @@ describe("isLoopbackHost", () => { |
| 27 | 26 | }); |
| 28 | 27 | }); |
| 29 | 28 | |
| 30 | | describe("isPreviewableUrl", () => { |
| 31 | | it.each([ |
| 32 | | "http://localhost:5173", |
| 33 | | "http://127.0.0.1:3000/path", |
| 34 | | "http://0.0.0.0:8080", |
| 35 | | "http://[::1]:5173", |
| 36 | | ])("%s is previewable", (url) => { |
| 37 | | expect(isPreviewableUrl(url)).toBe(true); |
| 38 | | }); |
| 39 | | |
| 40 | | it.each(["https://example.com", "ws://localhost:5173", "file:///etc/passwd", "not-a-url", ""])( |
| 41 | | "%s is not previewable", |
| 42 | | (url) => { |
| 43 | | expect(isPreviewableUrl(url)).toBe(false); |
| 44 | | }, |
| 45 | | ); |
| 46 | | }); |
| 47 | | |
| 48 | 29 | describe("normalizePreviewUrl", () => { |
| 49 | 30 | it("treats bare loopback hosts as http", () => { |
| 50 | 31 | expect(normalizePreviewUrl("localhost:5173")).toBe("http://localhost:5173/"); |