Add comprehensive automated testing infrastructure

Backend:
  - pytest configuration with async support and coverage
  - Unit tests for notification service (23 tests)
  - Unit tests for smart plug manager (12 tests)
  - Unit tests for archive service (16 tests)
  - Integration tests for API endpoints
  - Fix: notifications now send immediately (digest is summary only)

  Frontend:
  - Vitest configuration with jsdom and coverage
  - MSW for API mocking
  - Component tests for Toggle, Button, Card, ConfirmModal (77 tests)
  - Test utilities with custom render wrapper

  CI/CD:
  - GitHub Actions workflow for automated testing
  - Backend lint, unit tests, integration tests
  - Frontend lint, type-check, unit tests, build
This commit is contained in:
maziggy
2025-12-11 10:03:40 +01:00
parent c3026632da
commit ff53e62ef8
126 changed files with 101955 additions and 10 deletions
+7 -7
View File
@@ -491,13 +491,16 @@ class NotificationService:
):
"""Send notification to multiple providers and log the results.
Args:
force_immediate: If True, bypass digest mode and send immediately (for alarms)
All notifications are always sent immediately. If digest mode is enabled,
the notification is ALSO queued for the daily digest summary.
"""
for provider in providers:
try:
# Check if provider wants digest mode (unless force_immediate is set)
if not force_immediate and provider.daily_digest_enabled and provider.daily_digest_time:
# Always send notification immediately
success, error = await self._send_to_provider(provider, title, message)
# Also queue for digest if enabled (digest is a summary, not a queue)
if provider.daily_digest_enabled and provider.daily_digest_time:
await self._queue_for_digest(
provider=provider,
event_type=event_type,
@@ -507,9 +510,6 @@ class NotificationService:
printer_id=printer_id,
printer_name=printer_name,
)
continue
success, error = await self._send_to_provider(provider, title, message)
await self._update_provider_status(db, provider.id, success, error if not success else None)
await self._log_notification(
db=db,