diff --git a/tests/test_import_service_sql_params.py b/tests/test_import_service_sql_params.py index 8c2cdf4..3d0dcff 100644 --- a/tests/test_import_service_sql_params.py +++ b/tests/test_import_service_sql_params.py @@ -26,6 +26,14 @@ def test_daily_snapshot_delete_casts_text_date_column_on_postgres(monkeypatch): assert import_service._normalise_date_values_for_sql(["2026-05-01"]) == [date(2026, 5, 1)] +def test_daily_snapshot_delete_query_uses_snapshot_date_cast_helper(): + source = Path("services/import_service.py").read_text(encoding="utf-8") + + assert 'snapshot_date_expr = _date_filter_expr("snapshot_date")' in source + assert "DELETE FROM {table_name} WHERE {snapshot_date_expr} IN" in source + assert "DELETE FROM daily_sales_snapshot WHERE snapshot_date IN" not in source + + def test_daily_snapshot_delete_uses_iso_dates_on_sqlite(monkeypatch): monkeypatch.setattr(import_service, "_db_dialect_name", lambda: "sqlite")