Skip to content

Commit 761c6c1

Browse files
committed
test: add test for unpkgUrl
1 parent 78c41fc commit 761c6c1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/unpkg-url.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { expect, test } from "vitest";
2+
import { makeUnpkgUrl } from "./unpkg-url";
3+
4+
test("unpkgUrl", () => {
5+
const unpkgUrl = makeUnpkgUrl(["foo@1.0.0"]);
6+
expect(
7+
unpkgUrl({
8+
kind: "variable",
9+
id: "foo",
10+
name: "foo",
11+
docs: [],
12+
file: "/foo/foo.ts",
13+
line: 123,
14+
signature: "const foo: Foo;",
15+
}),
16+
).toMatchInlineSnapshot(`"https://unpkg.com/browse/foo@1.0.0/foo.ts#L123"`);
17+
expect(
18+
unpkgUrl({
19+
kind: "variable",
20+
id: "bar",
21+
name: "bar",
22+
docs: [],
23+
file: "/bar/bar.ts",
24+
line: 123,
25+
signature: "const bar: Bar;",
26+
}),
27+
).toMatchInlineSnapshot(`"https://unpkg.com/browse/bar/bar.ts#L123"`);
28+
});

0 commit comments

Comments
 (0)