import { describe, expect, test } from "bun:test"; import { assertSafeRssUrl, RssUrlUnsafeError } from "./rss-url"; describe("assertSafeRssUrl", () => { test("allows https example", () => { expect(() => assertSafeRssUrl("https://example.com/feed.xml")).not.toThrow(); }); test("rejects file protocol", () => { expect(() => assertSafeRssUrl("file:///etc/passwd")).toThrow(RssUrlUnsafeError); }); test("rejects localhost", () => { expect(() => assertSafeRssUrl("http://localhost/feed")).toThrow(RssUrlUnsafeError); }); test("rejects private ipv4 literal", () => { expect(() => assertSafeRssUrl("http://192.168.1.1/feed")).toThrow(RssUrlUnsafeError); }); });