feat: Add comprehensive unit and integration testing infrastructure #38

Merged
jimmy merged 6 commits from feature/add-testing-infrastructure into main 2026-03-30 11:19:19 +08:00
Owner

Summary

This PR adds comprehensive testing infrastructure for both backend and frontend:

Backend Testing (Python/FastAPI)

  • Unit tests: auth.py, rbac.py, config.py (~85 tests)
  • Integration tests: auth flow, Docker operations, file operations (~40 tests)
  • Framework: pytest with pytest-asyncio, pytest-cov, pytest-mock
  • Coverage goal: 80%+ overall, 95%+ for critical paths

Frontend Testing (Svelte 5/Vitest)

  • Unit tests: API client with token management and auto-refresh (~30 tests)
  • Component tests: Login component rendering and interaction
  • Framework: Vitest with @testing-library/svelte, jsdom
  • Coverage goal: 70%+ overall, 80%+ for critical components

CI/CD Integration

  • Automated testing via Gitea Actions on push/PR
  • Runs backend unit + integration tests with coverage
  • Runs frontend tests with coverage
  • Uploads coverage reports as artifacts

Documentation

  • TESTING.md: Comprehensive guide with setup, usage, debugging, and best practices
  • TESTING_IMPLEMENTATION_PLAN.md: Detailed implementation plan and strategy

Files Changed

  • 20 files changed, 3313 insertions(+)
  • New test files: 14
  • New config files: 3
  • Documentation: 2
  • CI workflow: 1

Testing

Tests can be run locally:

# Backend
cd dashboard/backend
pytest --cov=. --cov-report=term

# Frontend
cd dashboard/frontend
npm test -- --coverage

Next Steps

After merge, tests will run automatically on all future commits and PRs.

## Summary This PR adds comprehensive testing infrastructure for both backend and frontend: ### Backend Testing (Python/FastAPI) - **Unit tests**: auth.py, rbac.py, config.py (~85 tests) - **Integration tests**: auth flow, Docker operations, file operations (~40 tests) - **Framework**: pytest with pytest-asyncio, pytest-cov, pytest-mock - **Coverage goal**: 80%+ overall, 95%+ for critical paths ### Frontend Testing (Svelte 5/Vitest) - **Unit tests**: API client with token management and auto-refresh (~30 tests) - **Component tests**: Login component rendering and interaction - **Framework**: Vitest with @testing-library/svelte, jsdom - **Coverage goal**: 70%+ overall, 80%+ for critical components ### CI/CD Integration - Automated testing via Gitea Actions on push/PR - Runs backend unit + integration tests with coverage - Runs frontend tests with coverage - Uploads coverage reports as artifacts ### Documentation - **TESTING.md**: Comprehensive guide with setup, usage, debugging, and best practices - **TESTING_IMPLEMENTATION_PLAN.md**: Detailed implementation plan and strategy ## Files Changed - 20 files changed, 3313 insertions(+) - New test files: 14 - New config files: 3 - Documentation: 2 - CI workflow: 1 ## Testing Tests can be run locally: ```bash # Backend cd dashboard/backend pytest --cov=. --cov-report=term # Frontend cd dashboard/frontend npm test -- --coverage ``` ## Next Steps After merge, tests will run automatically on all future commits and PRs.
jimmy added 6 commits 2026-03-30 11:12:41 +08:00
feat: add comprehensive unit and integration testing infrastructure
Run Tests / Backend Tests (pull_request) Has been cancelled
Run Tests / Frontend Tests (pull_request) Has been cancelled
Run Tests / Test Summary (pull_request) Has been cancelled
8431920d26
- Backend: pytest with unit tests (auth, rbac, config) and integration tests (auth flow, docker, files)
- Frontend: vitest with unit tests (api client) and component tests (login)
- CI: Gitea Actions workflow for automated testing with coverage reports
- Documentation: TESTING.md guide with setup, usage, and best practices
- Coverage goals: 80%+ backend, 70%+ frontend
jimmy merged commit 0c9a281990 into main 2026-03-30 11:19:19 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jimmy/nas-tools#38