import { describe, expect, it } from "vitest"; import { feedHostKey } from "./feeds.ts"; describe("feedHostKey", () => { it("同站子域名 / www 归到同一键", () => { expect(feedHostKey("https://hhanclub.net/torrentrss.php?passkey=x")).toBe("hhanclub.net"); expect(feedHostKey("https://www.hhanclub.net/")).toBe("hhanclub.net"); expect(feedHostKey("https://rss.hhanclub.net/a")).toBe("hhanclub.net"); }); it("IP 原样;非法地址为 null", () => { expect(feedHostKey("http://127.0.0.1:8080/rss")).toBe("127.0.0.1"); expect(feedHostKey("not a url")).toBeNull(); }); });