18 lines
822 B
TypeScript
18 lines
822 B
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { sourceControlClients } from "./sourceControlClients.ts";
|
|
|
|
describe("sourceControlClients", () => {
|
|
it("reads a missing kind as the first host and an unshipped kind as the generic one", () => {
|
|
expect(sourceControlClients.get(undefined).kind).toBe("github");
|
|
expect(sourceControlClients.get("forkhost").kind).toBe("unknown");
|
|
});
|
|
|
|
it("gives a change request URL to the first host whose shape it has", () => {
|
|
// GitCafe and Forgejo share `/pulls/`; GitCafe only claims its own hostnames.
|
|
const kindOf = (url: string) => sourceControlClients.findByChangeRequestUrl(url)?.kind;
|
|
expect(kindOf("https://git.cafe/acme/web/pulls/7")).toBe("gitcafe");
|
|
expect(kindOf("https://codeberg.org/acme/web/pulls/7")).toBe("forgejo");
|
|
});
|
|
});
|