Files
VacatureRadar/tests/unit/test_jsonld_adapter.py
T
Jens b8091e59bd
deploy / deploy (push) Canceled after 0s
Initial deploy setup
2026-07-21 14:00:00 +02:00

16 lines
583 B
Python

import json
from pathlib import Path
from apps.sources.adapters.jsonld import JsonLdJobPostingAdapter
def test_extracts_sample_jobposting():
html = Path("fixtures/pages/sample_jsonld_job.html").read_text(encoding="utf-8")
expected = json.loads(Path("fixtures/golden/sample_jsonld_job.json").read_text())
result = JsonLdJobPostingAdapter().extract(html, url="https://jobs.example.org/source")
assert result.confidence >= 0.9
assert len(result.jobs) == 1
job = result.jobs[0]
for key, value in expected.items():
assert getattr(job, key) == value