20 lines
754 B
TypeScript
20 lines
754 B
TypeScript
import { test, expect, describe } from "bun:test";
|
|
import { detectPlatformFromHostname } from "../src/pr";
|
|
|
|
describe("pr platform detection", () => {
|
|
test("detects supported hosted platforms", () => {
|
|
expect(detectPlatformFromHostname("github.com")).toBe("github");
|
|
expect(detectPlatformFromHostname("gitlab.com")).toBe("gitlab");
|
|
});
|
|
|
|
test("detects self-hosted platform hostnames", () => {
|
|
expect(detectPlatformFromHostname("gitlab.example.com")).toBe("gitlab");
|
|
expect(detectPlatformFromHostname("gitea.example.com")).toBe("gitea");
|
|
});
|
|
|
|
test("returns null for unknown hostnames", () => {
|
|
expect(detectPlatformFromHostname("git.example.com")).toBeNull();
|
|
expect(detectPlatformFromHostname(null)).toBeNull();
|
|
});
|
|
});
|