"""The Ashby host module's places, work arrangement and employment, against a small saved board. No network. The pay and the shape of a plain row are in `test_ats.py`.""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from plugins.readers import Ask, ashby # noqa: E402 BOARD = (ROOT / "tests" / "fixtures" / "ats" / "ashby-places.json").read_bytes() def test_the_primary_and_every_secondary_location_are_places() -> None: first, second = ashby.parse(BOARD, "acme") assert first["places"] == [{"text": "San Francisco", "remote": False}, {"text": "London, UK", "remote": None}, {"text": "Remote - US", "remote": True}] assert first["location"] == "San Francisco; London, UK; Remote - US" assert second["places"] == [{"text": "Dublin", "remote": True}] def test_a_hybrid_role_is_not_remote_although_the_host_flags_it() -> None: first, second = ashby.parse(BOARD, "acme") assert first["remote"] == "hybrid" and second["remote"] == "remote" def test_the_employment_type_is_mapped() -> None: first, second = ashby.parse(BOARD, "acme") assert (first["employment"], second["employment"]) == ("full_time", "contract") def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None: reads = ashby.READS assert (reads.listing, reads.text, reads.places, reads.empty) == ( "whole", "listing", "many", "suspect") assert reads.fields.posted == "trusted" and reads.fields.pay == "figures" assert reads.robots == "api: no robots.txt check needed (public board API), 2026-09-30" assert ashby.feed_url("acme", Ask()).endswith("/job-board/acme?includeCompensation=true")