Commit Graph

8 Commits

Author SHA1 Message Date
William Valentin
15170a4f43 db(couchdb): auto-provision databases on startup for production strategy; add TokenService with CouchDB-backed token storage and localStorage fallback; switch OAuth to unified config for client IDs and redirect URI; express Request typing for req.user; align exportAsEnvVars with show-config expectations; remove Vite importmap from index.html; prefer babel-jest over ts-jest; remove duplicate uuid mocking from Jest config 2025-09-09 12:30:38 -07:00
William Valentin
7029ec0b0d fix: resolve email verification service test failures
- Fix missing imports and dependencies in email verification tests
- Update email verification service implementation
- Resolve test reference errors that were causing failures
- Improve error handling and test reliability

This fixes the 3 failing database service tests mentioned in the improvement summary.
2025-09-08 11:43:28 -07:00
William Valentin
7615600090 test: add authentication middleware tests
- Add comprehensive tests for auth middleware functionality
- Test authentication validation, session handling, and security
- Ensure proper request/response handling in auth pipeline
- Improve authentication service test coverage

This strengthens the authentication layer testing.
2025-09-08 11:36:36 -07:00
William Valentin
2556250f2c feat: add comprehensive test coverage and fix lint issues
- Add comprehensive tests for MailgunService (439 lines)
  * Email sending functionality with template generation
  * Configuration status validation
  * Error handling and edge cases
  * Mock setup for fetch API and FormData

- Add DatabaseService tests (451 lines)
  * Strategy pattern testing (Mock vs Production)
  * All CRUD operations for users, medications, settings
  * Legacy compatibility method testing
  * Proper TypeScript typing

- Add MockDatabaseStrategy tests (434 lines)
  * Complete coverage of mock database implementation
  * User operations, medication management
  * Settings and custom reminders functionality
  * Data persistence and error handling

- Add React hooks tests
  * useLocalStorage hook with comprehensive edge cases (340 lines)
  * useSettings hook with fetch operations and error handling (78 lines)

- Fix auth integration tests
  * Update mocking to use new database service instead of legacy couchdb.factory
  * Fix service variable references and expectations

- Simplify mailgun config tests
  * Remove redundant edge case testing
  * Focus on core functionality validation

- Fix all TypeScript and ESLint issues
  * Proper FormData mock typing
  * Correct database entity type usage
  * Remove non-existent property references

Test Results:
- 184 total tests passing
- Comprehensive coverage of core services
- Zero TypeScript compilation errors
- Full ESLint compliance
2025-09-08 10:13:50 -07:00
William Valentin
38699c6724 test(auth): enhance auth integration tests with comprehensive coverage
- Restructure tests with better organization by functionality
- Add comprehensive test coverage for all auth flows
- Include OAuth authentication testing (registration and login)
- Add password management tests (change password, reset password)
- Test error scenarios and edge cases
- Improve type safety with proper interfaces
- Fix mock configuration and service interaction testing
- Add tests for user registration, login, and verification flows
2025-09-07 16:13:50 -07:00
William Valentin
65c846d7c5 test(auth): improve email verification service tests
- Restructure tests with better organization and describe blocks
- Add comprehensive test coverage for all service methods
- Test edge cases including expired tokens and database errors
- Add integration scenario tests for full verification flow
- Fix TypeScript issues with mock user creation
- Improve test isolation and mock management
- Add tests for unique token generation and error handling
2025-09-07 16:13:14 -07:00
William Valentin
315303b120 Fix pre-commit script to properly handle multiple files and resolve ESLint warnings 2025-09-07 13:34:39 -07:00
William Valentin
e48adbcb00 Initial commit: Complete NodeJS-native setup
- Migrated from Python pre-commit to NodeJS-native solution
- Reorganized documentation structure
- Set up Husky + lint-staged for efficient pre-commit hooks
- Fixed Dockerfile healthcheck issue
- Added comprehensive documentation index
2025-09-06 01:42:48 -07:00