Skip to content

test: increase test coverage from 40% to 68% (sessions.ts 0% → 81%) - #169

Open
kannupriyakalra wants to merge 1 commit into
mainfrom
feat/increase-test-coverage
Open

test: increase test coverage from 40% to 68% (sessions.ts 0% → 81%)#169
kannupriyakalra wants to merge 1 commit into
mainfrom
feat/increase-test-coverage

Conversation

@kannupriyakalra

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrites sessions.test.ts to actually import and call the exported functions (listSessions, getSession, getAnalytics, getRepoScore, listReposWithScores) instead of re-implementing logic inline — which is why sessions.ts had 0% coverage before
  • Uses temp-dir fixtures + vi.mock('os') to isolate tests from the real ~/.copilot directory
  • Adds 35 new passing tests covering: session parsing, status detection, duration calculation, analytics aggregation, repo scoring, and edge cases

Coverage improvement

File Before After (lines)
sessions.ts 0% 80.78%
Overall statements 40.1% 67.79%
Overall lines 42.85% 71.51%

Test plan

  • Run npm test — all 133 tests should pass
  • Run npx vitest run --coverage — confirm sessions.ts lines ≥ 80%

Closes #168

🤖 Generated with Claude Code

sessions.ts had 0% coverage because existing tests re-implemented logic
inline instead of importing exported functions. Replaces them with tests
that call listSessions, getSession, getAnalytics, getRepoScore, and
listReposWithScores against real temp-dir fixtures.

sessions.ts lines: 0% → 80.78%
Overall statements: 40.1% → 67.79%

Closes #168

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Increase test coverage to 80%

1 participant