Skip to content

test: add domain and application layer unit tests#9

Merged
shepherdwind merged 1 commit into
mainfrom
test/007-domain-app-test-coverage
Apr 5, 2026
Merged

test: add domain and application layer unit tests#9
shepherdwind merged 1 commit into
mainfrom
test/007-domain-app-test-coverage

Conversation

@shepherdwind

Copy link
Copy Markdown
Owner

Background

Part of Phase 2 (Task 007) to achieve 90%+ test coverage across the repository. Current overall coverage is 46.92%.

Approach

Added unit tests for 4 modules in the domain and application layers, mocking all external dependencies (OpenAI, Gmail, Telegram, filesystem).

Changes

  • src/domain/models/__tests__/merchant-category-mapping.test.ts — 15 tests covering load, hot-reload, find (exact/partial/case-insensitive), add, persist, and error handling
  • src/domain/services/__tests__/accounting.service.test.ts — 14 tests covering all AccountingService methods including error paths
  • src/domain/services/__tests__/nlp.service.test.ts — 14 tests covering categorizeMerchant, autoCategorizeMerchant, parseExpenseInput, parseDateRange with success/error/edge cases
  • src/application/services/__tests__/automation.service.test.ts — 5 tests covering scheduledCheck with empty emails, successful processing, partial failures, and Gmail errors

Testing

  • All 97 tests pass (npm test)
  • Target modules at 100% statement coverage:
    • merchant-category-mapping.ts: 35.6% → 100%
    • accounting.service.ts: 43.8% → 100%
    • nlp.service.ts: 39.0% → 100%
    • automation.service.ts: 87.2% → 100%

Code Review

  • Review tool: codex
  • Rounds: 1
  • Issues fixed: none (passed on first round)

Add comprehensive test coverage for:
- merchant-category-mapping: load, hot-reload, find, add, persist
- accounting.service: all methods including error paths
- nlp.service: all NLP methods with mocked OpenAI
- automation.service: scheduled check, partial failures, notifications

All 4 modules now at 100% statement coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shepherdwind shepherdwind merged commit 123db6a into main Apr 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant