import { describe, expect, it } from "vitest"; import { extractJobLocationFromText, parseQaJobDetailPage, } from "../src/detail-page.js"; const SAMPLE_JSON_LD = `
`; describe("parseQaJobDetailPage", () => { it("extracts job location from JSON-LD description on the detail page", () => { const result = parseQaJobDetailPage(SAMPLE_JSON_LD); expect(result?.location).toBe("Mumbai/Nagpur"); expect(result?.jobDescription).toContain("Mumbai/Nagpur"); }); it("marks posting expired when validThrough is in the past", () => { const html = ``; expect(parseQaJobDetailPage(html)).toEqual({ expired: true }); }); it("extracts job location lines from plain text", () => { expect( extractJobLocationFromText( "Job Location: Vancouver, British Columbia, Canada", ), ).toBe("Vancouver, British Columbia, Canada"); }); });