"""Unit tests for Shared plans facility search helpers.""" from __future__ import annotations from onedrive_planner import ( FACILITY_NOT_APPEAR_MSG, _facility_search_terms, _row_matches_facility_search, ) def test_facility_search_terms_full_then_short(): terms = _facility_search_terms("Golden Hill Post Acute Care") assert terms == [ "Golden Hill Post Acute Care", "Golden Hill Post", "Golden Hill", ] def test_facility_search_terms_two_words_only(): terms = _facility_search_terms("Arbor Hills") assert terms == ["Arbor Hills"] def test_facility_search_terms_dedupes(): terms = _facility_search_terms("Golden Hill") assert terms == ["Golden Hill"] def test_row_matches_full_name_in_plan_title(): assert _row_matches_facility_search( "Golden Hill Subacute and Rehab", "Golden Hill Post Acute Care", "Golden Hill", ) def test_row_matches_exact(): assert _row_matches_facility_search( "Arbor Hills", "Arbor Hills", "Arbor Hills", ) def test_row_matches_rejects_unrelated(): assert not _row_matches_facility_search( "Sunrise Manor", "Golden Hill Post Acute Care", "Golden Hill", ) def test_not_appear_message_constant(): assert "shared plans" in FACILITY_NOT_APPEAR_MSG.lower()