From 62d9bbf1475af6bc5565badbdba6815da67b9418 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 16:08:17 +0000 Subject: [PATCH] =?UTF-8?q?The=20deal=20upsert=20lands=20client=5Fbooking?= =?UTF-8?q?=5Freference=20in=20the=20job=5Fno=20column=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- etl/hubspot/tests/test_hubspot_data_to_db.py | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/etl/hubspot/tests/test_hubspot_data_to_db.py b/etl/hubspot/tests/test_hubspot_data_to_db.py index ff4b82940..60c937460 100644 --- a/etl/hubspot/tests/test_hubspot_data_to_db.py +++ b/etl/hubspot/tests/test_hubspot_data_to_db.py @@ -85,3 +85,43 @@ def test_update_existing_deal__no_project__clears_project_id() -> None: ) assert existing.project_id is None + + +def test_update_existing_deal__client_booking_reference_maps_to_job_no() -> None: + existing = HubspotDealData(deal_id="MOCK_DEAL_ID", job_no=None) + deal_data = {"client_booking_reference": "AD0226519"} + + _make_instance()._update_existing_deal( + existing=existing, + deal_data=deal_data, + listing=None, + company=None, + ) + + assert existing.job_no == "AD0226519" + + +def test_update_existing_deal__client_booking_reference_cleared__nulls_job_no() -> None: + existing = HubspotDealData(deal_id="MOCK_DEAL_ID", job_no="AD0226519") + deal_data = {} + + _make_instance()._update_existing_deal( + existing=existing, + deal_data=deal_data, + listing=None, + company=None, + ) + + assert existing.job_no is None + + +def test_build_new_deal__client_booking_reference_maps_to_job_no() -> None: + new_deal = _make_instance()._build_new_deal( + deal_id="MOCK_DEAL_ID", + deal_data={"client_booking_reference": "AD0226519"}, + listing=None, + company=None, + project=None, + ) + + assert new_deal.job_no == "AD0226519"