33 lines
1 KiB
Python
33 lines
1 KiB
Python
from app.services.handoff_evaluator import evaluate_handoff
|
|
|
|
|
|
def test_handoff_requires_all_selected_filters():
|
|
email = {
|
|
"subject": "Payment approval required",
|
|
"snippet": "Please approve this invoice payment today.",
|
|
"body_text": "We need your approval for payment of $4,500.",
|
|
}
|
|
result = evaluate_handoff(
|
|
email=email,
|
|
labels=["Important", "Finance"],
|
|
email_types=["transactional"],
|
|
instructions="Forward when approval is required.",
|
|
)
|
|
assert result["would_handoff"] is True
|
|
assert result["label_matched"] is True
|
|
assert result["type_matched"] is True
|
|
|
|
|
|
def test_handoff_does_not_match_unrelated_instruction():
|
|
email = {
|
|
"subject": "Team lunch",
|
|
"snippet": "Where should we eat tomorrow?",
|
|
"body_text": "Let me know your preference.",
|
|
}
|
|
result = evaluate_handoff(
|
|
email=email,
|
|
labels=[],
|
|
email_types=[],
|
|
instructions="Forward when a refund requires approval.",
|
|
)
|
|
assert result["would_handoff"] is False
|