File size: 2,222 Bytes
5e0532d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import pytest
import asyncio
from app.services.intent import IntentService, UserIntent, IntentAnalysis

@pytest.fixture
def intent_service():
    return IntentService()

@pytest.mark.asyncio
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

@pytest.mark.asyncio
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

@pytest.mark.asyncio
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

@pytest.mark.asyncio
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

@pytest.mark.asyncio
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

@pytest.mark.asyncio
async def test_question_intent(intent_service):
    text = "Who are you?"
    result = await intent_service.analyze(text)
    assert result.intent == UserIntent.QUESTION
    
@pytest.mark.asyncio
async def test_unknown_intent(intent_service):
    text = "Hello there"
    result = await intent_service.analyze(text)
    assert result.intent == UserIntent.UNKNOWN

@pytest.mark.asyncio
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