mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 16:46:24 +00:00
21 lines
599 B
TypeScript
21 lines
599 B
TypeScript
import { afterEach, describe, expect, test } from "bun:test";
|
|
import { rssFetch } from "../src/helpers";
|
|
|
|
const originalFetch = globalThis.fetch;
|
|
|
|
afterEach(() => {
|
|
globalThis.fetch = originalFetch;
|
|
});
|
|
|
|
describe("rssFetch", () => {
|
|
test("reports Cloudflare bot protection clearly", async () => {
|
|
globalThis.fetch = (async () =>
|
|
new Response("<html><title>Just a moment...</title></html>", {
|
|
status: 403,
|
|
statusText: "Forbidden",
|
|
})) as unknown as typeof fetch;
|
|
|
|
await expect(rssFetch({ key: "data" })).rejects.toThrow(/Cloudflare bot protection/);
|
|
});
|
|
});
|