22 lines
827 B
Python
22 lines
827 B
Python
"""Tests for GreetingService."""
|
|
|
|
from app.services.greeting_service import GreetingService
|
|
|
|
|
|
class TestGreetingService:
|
|
"""Test cases for GreetingService."""
|
|
|
|
def test_get_greeting_without_name(self) -> None:
|
|
"""Test getting greeting without providing a name."""
|
|
result = GreetingService.get_greeting()
|
|
assert result == {"message": "Hello from backend!"}
|
|
|
|
def test_get_greeting_with_name(self) -> None:
|
|
"""Test getting greeting with a name."""
|
|
result = GreetingService.get_greeting("Alice")
|
|
assert result == {"message": "Hello, Alice!"}
|
|
|
|
def test_get_greeting_with_empty_string(self) -> None:
|
|
"""Test getting greeting with empty string name."""
|
|
result = GreetingService.get_greeting("")
|
|
assert result == {"message": "Hello from backend!"} |