Skip to content

test: add unit tests for API utils and skill prerequisites (Phase 2)#106

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test/coverage-improvements-phase2-329d864a99259d61
Draft

test: add unit tests for API utils and skill prerequisites (Phase 2)#106
github-actions[bot] wants to merge 1 commit intomainfrom
test/coverage-improvements-phase2-329d864a99259d61

Conversation

@github-actions
Copy link
Copy Markdown

Summary

Phase 2 implementation from the Daily Test Coverage Improver plan. Adds 45 new unit tests across 3 previously untested files.

Coverage improvements

File Tests added What's covered
src/lib/api/validation-utils.ts 20 validateObject, validateRequiredString — null/undefined/wrong-type inputs, empty/whitespace strings, field name in messages
src/lib/api/response-utils.ts 13 apiSuccess (200), validationErrorResponse (400), serviceUnavailableResponse (503) — status codes, body shape, meta inclusion/omission
src/lib/skills/prerequisites.ts 12 getNextAchievableSkills — empty profile, prerequisite unlocking, already-intermediate exclusion, duplicate skill deduplication (highest level wins), full-advanced empty result, multi-prerequisite chains

Baseline: 63 test files, 1035 tests
After: 66 test files, 1080 tests (+45)

Test approach

  • Follows existing repo conventions: colocated *.test.ts, AAA pattern, it.each for table-driven cases
  • Pure functions only — no mocks required for validation-utils or prerequisites
  • response-utils tests call NextResponse.json directly and assert on status codes and parsed JSON body shapes

Closes

Resolves #55

Generated by Daily Test Coverage Improver

To install this workflow, run gh aw add githubnext/agentics/workflows/daily-test-improver.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/daily-test-improver.md.

Add coverage for previously untested pure functions:
- src/lib/api/validation-utils.test.ts: 20 tests for validateObject and validateRequiredString
- src/lib/api/response-utils.test.ts: 13 tests for apiSuccess, validationErrorResponse, serviceUnavailableResponse
- src/lib/skills/prerequisites.test.ts: 12 tests for getNextAchievableSkills

All 45 new tests pass. Closes #55.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daily Test Coverage Improver - Research and Plan

0 participants