Skip to content

test: add infrastructure utilities and events tests#10

Merged
shepherdwind merged 1 commit into
mainfrom
test/008-infra-utils-events-test-coverage
Apr 5, 2026
Merged

test: add infrastructure utilities and events tests#10
shepherdwind merged 1 commit into
mainfrom
test/008-infra-utils-events-test-coverage

Conversation

@shepherdwind

Copy link
Copy Markdown
Owner

Background

Part of Phase 2 (Task 008) to achieve 90%+ test coverage. Overall coverage improved from 46.92% to 60.78%.

Approach

Added unit tests for infrastructure utilities, event system, and email parser modules. All external dependencies mocked.

Changes

  • query-result-formatter.test.ts — 6 tests: formatting, user aggregation, empty results, unmapped accounts
  • date.utils.test.ts — 8 tests: all 4 format functions with edge cases
  • logger.test.ts — 12 tests: log levels, output routing, Error vs non-Error, object printing, createLogger
  • container.test.ts — 8 tests: register/get/factory/has/remove/clear
  • telegram.test.ts — 8 tests: account maps, getCashAccount, getCardAccount, getAccountByEmail
  • message-queue.service.test.ts — 8 tests: enqueue, dedup, complete, timeout, clearByMerchant
  • beancount-query.service.test.ts — +2 tests: queryByDateRange, executeQuery error
  • dbs-transaction-extractor.test.ts — 9 tests: amount formats, missing fields, rounding
  • email-parser-factory.test.ts — 4 tests: find/register/parse with custom parsers

Testing

  • All 173 tests pass
  • Target module coverage improvements:
    • query-result-formatter: 6% → 100%
    • date.utils: 67% → 100%
    • telegram.ts: 61% → 100%
    • container.ts: 83% → 100%
    • beancount-query.service: 70% → 100%
    • email-parser-factory: 83% → 100%
    • message-queue.service: 71% → 95%
    • logger: 66% → 90%
    • dbs-transaction-extractor: 70% → 84%

Code Review

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

Add comprehensive test coverage for:
- query-result-formatter: assets/expenses formatting, user aggregation
- date.utils: all 4 format functions with edge cases
- logger: log levels, output routing, object pretty-printing
- container: register/get/factory/has/remove/clear
- telegram utils: account maps, getCashAccount, getCardAccount, getAccountByEmail
- message-queue.service: enqueue, dedup, complete, timeout, clearByMerchant
- beancount-query.service: queryByDateRange, executeQuery error handling
- dbs-transaction-extractor: amount formats, missing fields, rounding
- email-parser-factory: find/register/parse with custom parsers

Overall coverage: 46.92% → 60.78%

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shepherdwind shepherdwind merged commit d8fcfa8 into main Apr 5, 2026
3 checks passed
@shepherdwind shepherdwind deleted the test/008-infra-utils-events-test-coverage branch April 5, 2026 08:45
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