from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]


def read(path: str) -> str:
    return (ROOT / path).read_text(encoding="utf-8")


def test_followup_metadata_update_casts_jsonb_parameters():
    source = read("app/followup_service.py")
    assert "last_follow_up_task_id', CAST(:task_id AS TEXT)" in source
    assert "last_follow_up_scheduled_at', now()::text" in source
    assert "jsonb_build_object('last_follow_up_task_id', :task_id" not in source
