Commit Graph

1 Commits (deploy/enterprise)

Author SHA1 Message Date
-LAN- 51f26a83c6
test: add comprehensive unit tests for EmailI18nService
- Created comprehensive test suite with 19 test cases covering all EmailI18nService functionality
- Implemented mock classes (MockEmailRenderer, MockBrandingService, MockEmailSender) following protocol pattern
- Avoided using patch decorator, instead using constructor dependency injection for cleaner testing
- Tests cover:
  * Email sending with different languages (English, Chinese, fallback handling)
  * Branding enabled/disabled scenarios
  * Change email workflows (old/new phases)
  * Raw email sending (single and multiple recipients)
  * Error handling for invalid phases and missing templates
  * Subject templating with variables
  * Integration tests for default configuration and service creation
  * Flask-specific components (renderer and sender)

The tests follow DDD principles with proper separation of concerns and use
dependency injection rather than mocking frameworks for cleaner, more maintainable tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
9 months ago