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

sourceControlClients.test.ts

16 lines739 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { sourceControlClients } from "./sourceControlClients.ts";
4​
5describe("sourceControlClients", () => {
6 it("reads a missing kind as the first host and an unshipped kind as the generic one", () => {
7 expect(sourceControlClients.get(undefined).kind).toBe("github");
8 expect(sourceControlClients.get("forkhost").kind).toBe("unknown");
9 });
10​
11 it("gives a change request URL to the first host whose shape it has", () => {
12 const kindOf = (url: string) => sourceControlClients.findByChangeRequestUrl(url)?.kind;
13 expect(kindOf("https://git.cafe/acme/web/pulls/7")).toBe("gitcafe");
14 expect(kindOf("https://codeberg.org/acme/web/pulls/7")).toBe("forgejo");
15 });
16});