test: add infrastructure adapters test coverage#11
Merged
Conversation
Add comprehensive tests for Gmail, OpenAI, and Telegram adapters: - token-manager: OAuth flow, token refresh, init, save, invalidation - email-processor: fetch emails, mark as read, error handling - email.utils: header extraction, body decoding, HTML conversion - gmail.adapter: initialize, fetch, mark as read - openai.adapter: processMessage, model defaults, error handling - telegram.adapter: constructor, init, sendNotification with retry - query-command-handler: all time ranges, callback handling - custom-query-command-handler: query parsing, NLP integration - categorization-constants: all exports verified - add-bill conversation: full flow including cancel, confirm, errors - categorization conversation: flow with merchant lookup, NLP, selection Overall coverage: 46.92% → 91.5% Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Part of Phase 2 (Task 009) to achieve 90%+ test coverage. This is the final task, completing the coverage goal.
Approach
Added unit tests for all infrastructure adapters (Gmail, OpenAI, Telegram) with comprehensive mocking of external APIs and services.
Changes
Gmail adapters:
token-manager.test.ts— 16 tests: OAuth flow, token refresh, init, invalidation, saveemail-processor.test.ts— 5 tests: fetch, mark as read, error handlingemail.utils.test.ts— 8 tests: headers, body decoding, HTML conversiongmail.adapter.test.ts— 3 tests: initialize, fetch, markAsReadOpenAI adapter:
openai.adapter.test.ts— 5 tests: model defaults, processMessage, error handlingTelegram adapters:
telegram.adapter.test.ts— 9 tests: constructor, init, sendNotification with retry, pending merchantsquery-command-handler.test.ts— 10 tests: handle, all time ranges, callback handlingcustom-query-command-handler.test.ts— 6 tests: query parsing, NLP integration, error handlingcategorization-constants.test.ts— 4 tests: all constant exportsConversations:
add-bill.test.ts— 10 tests: full flow including cancel, confirm, NLP error, unauthorized usercategorization.test.ts— 6 tests: merchant lookup, NLP categorization, category selection, errorTesting
Code Review