test(backend): update and add service tests

Updated tests:
- test_ontology_service.py: update ontology service tests

New tests:
- test_expense_claim_service.py: add expense claim service tests
- test_reimbursement_endpoints.py: add reimbursement endpoint tests
This commit is contained in:
caoxiaozhu
2026-05-13 06:46:24 +00:00
parent 6317fc0ccd
commit 13df8fc9dc
3 changed files with 608 additions and 0 deletions

View File

@@ -333,6 +333,24 @@ def test_semantic_ontology_service_extracts_day_before_yesterday_from_client_loc
assert result.time_range.end_date == "2026-05-11"
def test_semantic_ontology_service_maps_office_supplies_to_office_expense_type() -> None:
session_factory = build_session_factory()
with session_factory() as db:
result = SemanticOntologyService(db).parse(
OntologyParseRequest(
query="我买了办公用品和文具花了88元帮我报销",
user_id="pytest",
)
)
assert result.scenario == "expense"
assert result.intent == "draft"
assert any(
item.type == "expense_type" and item.normalized_value == "office"
for item in result.entities
)
def test_semantic_ontology_service_uses_model_parse_when_available(monkeypatch) -> None:
session_factory = build_session_factory()
with session_factory() as db: