Skip to content

test: add comprehensive unit tests (17 files, 297 new tests)#133

Merged
zbigniewsobiecki merged 1 commit intodevfrom
test/comprehensive-unit-test-coverage
Feb 11, 2026
Merged

test: add comprehensive unit tests (17 files, 297 new tests)#133
zbigniewsobiecki merged 1 commit intodevfrom
test/comprehensive-unit-test-coverage

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Add 17 new test files covering previously untested modules
  • Increase test count from 139 to 436 (+297 tests)
  • Increase line coverage from 16.4% to 29.2% (+78% relative improvement)
  • Achieve 100% coverage on 6 critical modules: github/client.ts, types.ts, llmLogging.ts, llmMetrics.ts, safeOperation.ts, repo.ts

What's covered

Tier 1 - Triggers and core logic (10 files)

Test file Source file Coverage
github-types.test.ts triggers/github/types.ts 100% - all 5 type guard validators
pr-opened.test.ts triggers/github/pr-opened.ts 100% - matches + handle
check-suite-success.test.ts triggers/github/check-suite-success.ts 100%
check-suite-failure.test.ts triggers/github/check-suite-failure.ts 100% - incl. retry counter
pr-review-submitted.test.ts triggers/github/pr-review-submitted.ts 100%
issue-comment.test.ts triggers/github/issue-comment.ts 100%
pr-review-comment.test.ts triggers/github/pr-review-comment.ts 100%
pr-ready-to-merge.test.ts triggers/github/pr-ready-to-merge.ts 98%
projects.test.ts config/projects.ts load/cache/clear + finders
safeOperation.test.ts utils/safeOperation.ts 100%

Tier 2 - Client, utils, and gadgets (7 files)

Test file Source file Coverage
client.test.ts github/client.ts 100% - all 15+ Octokit methods
llmMetrics.test.ts utils/llmMetrics.ts 100% - cost calc, token estimation
todo-storage.test.ts gadgets/todo/storage.ts 97% - CRUD + formatting
lifecycle.test.ts utils/lifecycle.ts 85% - timers, watchdog, shutdown
attachment-added.test.ts triggers/trello/attachment-added.ts 98% - zip parsing, auth
repo.test.ts utils/repo.ts 98% - workspace, clone, runCommand
llmLogging.test.ts utils/llmLogging.ts 100% - call logging

Test plan

  • All 436 tests pass locally
  • Pre-commit hooks pass (lint, typecheck)
  • Pre-push hook passes (test suite)
  • CI passes on this branch

🤖 Generated with Claude Code

…g, and utils

Add 17 new test files covering previously untested modules, increasing
test count from 139 to 436 and line coverage from 16.4% to 29.2%.

Tier 1 - Triggers and core logic (10 files):
- GitHub type guards: all 5 validators with valid/invalid/edge cases
- PR opened: matches(), handle() with Trello URL extraction
- Check suite success: CI pass detection, PR fetching, check verification
- Check suite failure: failure detection, attempt tracking, max retries
- PR review submitted: self-review skip, bot detection, auth fallback
- Issue comment: PR vs issue distinction, self-comment skip
- PR review comment: file path extraction, auth error tolerance
- PR ready to merge: dual-trigger (check_suite + review), merge readiness
- Projects config: load/cache/clear lifecycle, finder functions, tokens
- Safe operation: error swallowing with/without logging

Tier 2 - Client, utils, and gadgets (7 files):
- GitHub client: all 15+ Octokit methods with response mapping
- LLM metrics: cost calculation, token estimation, structured logging
- Todo storage: init/load/save/format with fs mocking
- Lifecycle: timer management, watchdog, shutdown scheduling
- Attachment added: zip pattern parsing, user verification, debug loop prevention
- Repo utils: workspace dirs, temp dirs, clone, runCommand with spawn mocking
- LLM logging: call number formatting, request/response file logging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 8aa1f55 into dev Feb 11, 2026
3 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the test/comprehensive-unit-test-coverage branch February 11, 2026 14:01
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