feat(server): add anime_service wrapper, unit tests, update docs
This commit is contained in:
27
tests/unit/test_anime_service.py
Normal file
27
tests/unit/test_anime_service.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
|
||||
import pytest
|
||||
|
||||
from src.server.services.anime_service import AnimeService, AnimeServiceError
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_missing_empty(tmp_path):
|
||||
svc = AnimeService(directory=str(tmp_path))
|
||||
# SeriesApp may return empty list depending on filesystem; ensure it returns a list
|
||||
result = await svc.list_missing()
|
||||
assert isinstance(result, list)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_search_empty_query(tmp_path):
|
||||
svc = AnimeService(directory=str(tmp_path))
|
||||
res = await svc.search("")
|
||||
assert res == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_rescan_and_cache_clear(tmp_path):
|
||||
svc = AnimeService(directory=str(tmp_path))
|
||||
# calling rescan should not raise
|
||||
await svc.rescan()
|
||||
Reference in New Issue
Block a user