Jobber/extractors/qajobsboard/tests/detail-page.test.ts
ilia 03d293699a
Some checks failed
CI / Linting (Biome) (push) Failing after 40s
CI / Tests (push) Successful in 5m13s
CI / Type Check (adzuna-extractor) (push) Successful in 1m10s
CI / Type Check (gradcracker-extractor) (push) Successful in 1m14s
CI / Type Check (hiringcafe-extractor) (push) Successful in 1m11s
CI / Type Check (orchestrator) (push) Successful in 1m30s
CI / Type Check (startupjobs-extractor) (push) Successful in 1m12s
CI / Type Check (ukvisajobs-extractor) (push) Successful in 1m13s
CI / Documentation (push) Successful in 1m57s
feat(qajobsboard): fetch job detail pages for concrete location text
The jobs.json feed often labels roles Remote/Worldwide while the public
job page JSON-LD and description include the real city (e.g. Mumbai/Nagpur).
Enrich vague rows by reading each QAJobsBoard detail URL before import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-16 17:20:53 -04:00

34 lines
1.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
extractJobLocationFromText,
parseQaJobDetailPage,
} from "../src/detail-page.js";
const SAMPLE_JSON_LD = `<!DOCTYPE html><html><body>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "JobPosting",
"title": "Sr. QA Automation Engineer",
"description": "<p><strong>Job Location: Mumbai/Nagpur</strong></p><p>India | UK | USA</p>",
"jobLocationType": "TELECOMMUTE"
}
</script>
</body></html>`;
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("extracts job location lines from plain text", () => {
expect(
extractJobLocationFromText(
"Job Location: Vancouver, British Columbia, Canada",
),
).toBe("Vancouver, British Columbia, Canada");
});
});