feat(frontend): 新增廠商缺貨清單 V2

This commit is contained in:
OoO
2026-05-01 00:12:06 +08:00
parent c9247f7a79
commit 99d5bc8e81
7 changed files with 615 additions and 254 deletions

View File

@@ -67,14 +67,35 @@ def test_edm_dashboard_v2_is_feature_flagged_and_uses_real_campaign_data():
def test_vendor_stockout_v2_is_feature_flagged_and_uses_real_vendor_data():
route_source = (ROOT / "routes/vendor_routes.py").read_text(encoding="utf-8")
template = (ROOT / "web/templates/vendor_stockout_index_v2.html").read_text(encoding="utf-8")
template = (ROOT / "templates/vendor_stockout_index_v2.html").read_text(encoding="utf-8")
assert "request.args.get('ui') == 'v2'" in route_source
assert not (ROOT / "web/templates/vendor_stockout_index_v2.html").exists()
assert "vendor_stockout_index_v2.html" in route_source
assert "_get_vendor_dashboard_stats()" in route_source
assert "session.query(VendorStockout).count()" in route_source
assert "EmailSendLog" in route_source
assert "stats.get('pending_stockouts'" in template
assert "stats.get('email_success_rate'" in template
assert "stats.pending_stockouts" in template
assert "stats.email_success_rate" in template
assert "mock" not in template.lower()
assert "" not in template
def test_vendor_stockout_list_v2_is_feature_flagged_and_uses_real_stockout_rows():
route_source = (ROOT / "routes/vendor_routes.py").read_text(encoding="utf-8")
template = (ROOT / "templates/vendor_stockout_list_v2.html").read_text(encoding="utf-8")
assert "vendor_stockout_list_v2.html" in route_source
assert "_get_vendor_stockout_list_context()" in route_source
assert "_apply_stockout_filters(" in route_source
assert "session.query(VendorStockout)" in route_source
assert "VendorStockout.status == 'pending'" in route_source
assert "VendorStockout.batch_id == batch_id" in route_source
assert "{% for record in records %}" in template
assert "{% for batch in batches %}" in template
assert "stats.pending" in template
assert "record.product_code" in template
assert "record.product_name" in template
assert "record.vendor_name" in template
assert "mock" not in template.lower()
assert "" not in template