Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

tanStackSourceHosts.test.ts

31 lines1014 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { parseTanStackSourceRemote, tanStackSourceRepositoryPath } from "./tanStackSourceHosts.ts";
4​
5describe("tanStackSourceRepositoryPath", () => {
6 it.each([
7 ["acme/web", "acme/web"],
8 ["@acme/web", "acme/web"],
9 // Clients without this host's definition percent-encode the owner's `@`.
10 ["%40acme/web", "acme/web"],
11 ["/@acme/web.git/", "acme/web"],
12 ["acme/web.private", "acme/web.private"],
13 ["acme", null],
14 ["acme/web/extra", null],
15 ["acme/..", null],
16 ])("reads %s as %s", (path, repository) => {
17 expect(tanStackSourceRepositoryPath(path)).toBe(repository);
18 });
19});
20​
21describe("parseTanStackSourceRemote", () => {
22 it.each([
23 "https://source.tanstack.com/@tanstack/ai.git",
24 "https://source.tanstack.com/tanstack/ai.git",
25 ])("resolves the clone URL %s", (url) => {
26 expect(parseTanStackSourceRemote(url)).toEqual({
27 host: "source.tanstack.com",
28 repository: "tanstack/ai",
29 });
30 });
31});