Backend (103 tests): - Unit tests for listing_service, export_service, district_service - Regression tests for API response contracts and query parameter validation - Integration tests for API workflows, Redis listing cache, listing processor pipeline, and repository advanced queries - E2E tests for streaming with filters, batching, caching, and task management Frontend (116 tests): - Service tests for apiClient, streamingService, taskService, listingService, healthService - Hook tests for useTaskProgress (WebSocket + polling) - Component tests for PropertyCard, FilterPanel, Header, ListView, TaskProgressDrawer, TaskIndicator, StreamingProgressBar, HealthIndicator - E2E tests for filter-stream-display flow Infrastructure: - Add pytest-xdist and test markers (regression, integration, e2e) - Add conftest fixtures: fake_redis, rent_listing_factory, seeded_repository - Add vitest + testing-library + MSW for frontend testing
34 lines
1 KiB
Python
34 lines
1 KiB
Python
"""Unit tests for services/district_service.py."""
|
|
|
|
import pytest
|
|
|
|
from services import district_service
|
|
|
|
|
|
class TestGetAllDistricts:
|
|
def test_get_all_districts_returns_dict(self):
|
|
result = district_service.get_all_districts()
|
|
assert isinstance(result, dict)
|
|
assert len(result) > 0
|
|
|
|
|
|
class TestGetDistrictNames:
|
|
def test_get_district_names_returns_list(self):
|
|
result = district_service.get_district_names()
|
|
assert isinstance(result, list)
|
|
assert len(result) > 0
|
|
|
|
|
|
class TestValidateDistricts:
|
|
def test_validate_districts_all_valid(self):
|
|
result = district_service.validate_districts(["London", "Westminster"])
|
|
assert result == []
|
|
|
|
def test_validate_districts_returns_invalid(self):
|
|
result = district_service.validate_districts(["London", "Narnia"])
|
|
assert "Narnia" in result
|
|
|
|
def test_known_districts_present(self):
|
|
names = district_service.get_district_names()
|
|
for district in ["London", "Westminster", "Camden"]:
|
|
assert district in names
|