Spaces:
Sleeping
Sleeping
| import pytest | |
| import asyncio | |
| from app.services.intent import IntentService, UserIntent, IntentAnalysis | |
| def intent_service(): | |
| return IntentService() | |
| async def test_prayer_intent(intent_service): | |
| text = "Please pray for my sick mother" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.PRAYER_REQUEST | |
| assert result.requires_scripture is True | |
| async def test_emotional_support_intent(intent_service): | |
| text = "I feel so sad and lonely today" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.EMOTIONAL_SUPPORT | |
| assert result.requires_scripture is True | |
| async def test_bible_study_intent(intent_service): | |
| text = "Where can I find a verse about hope?" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.BIBLE_STUDY | |
| assert result.requires_scripture is True | |
| async def test_life_decision_intent(intent_service): | |
| text = "I don't know what to do about my job, I need guidance." | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.LIFE_DECISION | |
| assert result.requires_scripture is True | |
| async def test_confession_intent(intent_service): | |
| text = "I made a mistake and I need to confess my sins." | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.CONFESSION | |
| assert result.requires_scripture is True | |
| async def test_question_intent(intent_service): | |
| text = "Who are you?" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.QUESTION | |
| async def test_unknown_intent(intent_service): | |
| text = "Hello there" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.UNKNOWN | |
| async def test_priority_logic(intent_service): | |
| # "pray" (Prayer) vs "sad" (Emotional Support) -> Prayer matches first in our logic | |
| text = "I am sad so please pray for me" | |
| result = await intent_service.analyze(text) | |
| assert result.intent == UserIntent.PRAYER_REQUEST | |