Files
shanxia2.0/backend/tests/test_pl_plan_column_facet_context.py
wuzilongandCursor 6a8cd90b98 feat: cascade column facet options by current list context
Make dynamic column-facet values respect other active filters (Excel-style), with backend facet context helpers, list-page wiring, slip print/sidebar fixes, and refreshed graphify graphs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-11 22:04:20 +08:00

47 lines
1.5 KiB
Python

"""运输计划列头 facet 上下文剥离单测。"""
from app.services.pl.plan_column_facet_context import strip_plan_facet_self_params
def test_strip_carrier_keeps_load_customers():
params = {
"field": "carrierName",
"limit": 500,
"carrierNameIn": "甲,乙",
"loadCustomersIn": "客户A",
"transportStatus": "arranged",
}
out = strip_plan_facet_self_params(params, "carrierName")
assert "carrierNameIn" not in out
assert out["loadCustomersIn"] == "客户A"
assert out["transportStatus"] == "arranged"
assert "field" not in out
assert "limit" not in out
def test_strip_load_customer_aliases():
params = {
"loadCustomersIn": "A",
"loadCustomers": '["A"]',
"stopCustomers": '["A"]',
"deliveryCustomersIn": "B",
"carrierNameIn": "甲",
}
out = strip_plan_facet_self_params(params, "loadCustomer")
assert "loadCustomersIn" not in out
assert "stopCustomers" not in out
assert out["deliveryCustomersIn"] == "B"
assert out["carrierNameIn"] == "甲"
def test_strip_load_customers_field_alias():
params = {"loadCustomersIn": "A", "carrierNameIn": "甲"}
out = strip_plan_facet_self_params(params, "loadCustomers")
assert "loadCustomersIn" not in out
assert out["carrierNameIn"] == "甲"
def test_strip_does_not_mutate_input():
params = {"carrierNameIn": "甲", "loadCustomersIn": "A"}
strip_plan_facet_self_params(params, "carrierName")
assert params["carrierNameIn"] == "甲"