Commit Graph

6 Commits

Author SHA1 Message Date
William Valentin
a7e5df4b2e test: update mocks to use unified config structure
- Update mailgun service test mock to use unifiedConfig.app.baseUrl
- Update database service test mock to use unifiedConfig.app.baseUrl
- Ensures test mocks reflect actual unified configuration structure
- Maintains test compatibility after config system consolidation
2025-09-08 20:40:29 -07:00
William Valentin
3eb18a3b47 test: add email service comprehensive tests
- Add comprehensive tests for email service functionality
- Test email validation, sending capabilities, and error handling
- Improve service test coverage and reliability
- Ensure email operations work correctly in test environment

This adds another layer of service testing infrastructure.
2025-09-08 11:36:00 -07:00
William Valentin
5098631551 test: add comprehensive OAuth service tests
- Implement 21 OAuth tests covering Google and GitHub authentication flows
- Test URL generation, parameter validation, and navigation calls
- Use MockNavigationService for testable OAuth redirect verification
- Achieve 97.05% coverage for OAuth service (up from 31.66%)
- Test both success and error scenarios for OAuth flows
- Fix ESLint unused variable warnings

This resolves the 18 failing OAuth tests and provides robust test coverage.
2025-09-08 11:35:27 -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
22e996e698 Refactor Mailgun config to use getEnvVar and improve checks
- Replace getEnv with getEnvVar for environment variable access - Update
MailgunConfig types to allow undefined values - Enhance
isMailgunConfigured to check for undefined and empty values - Update
isDevelopmentMode to check production status - Improve test mocks for
environment variable handling
2025-09-07 18:36:55 -07:00
William Valentin
16d025e747 Add comprehensive test suite and update configuration
- Add Jest testing framework configuration
- Add test files for services, types, and utilities
- Update package.json with Jest dependencies and test scripts
- Enhance pre-commit checks to include testing
- Add proper environment validation and error handling in mailgun service
2025-09-07 18:18:25 -07:00