Skip to content

test: add unit tests for validation-utils, response-utils, and prerequisites#129

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test/coverage-validation-response-prerequisites-03afc55d5dfaacd0
Draft

test: add unit tests for validation-utils, response-utils, and prerequisites#129
github-actions[bot] wants to merge 1 commit intomainfrom
test/coverage-validation-response-prerequisites-03afc55d5dfaacd0

Conversation

@github-actions
Copy link
Copy Markdown

Closes part of #55 (Daily Test Coverage Improver - Research and Plan).

What

Adds 45 new unit tests across 3 previously-uncovered files in src/lib/api/ and src/lib/skills/.

Files Added

File Tests Coverage
src/lib/api/validation-utils.test.ts 21 validateObject, validateRequiredString — all branches
src/lib/api/response-utils.test.ts 15 apiSuccess, validationErrorResponse, serviceUnavailableResponse — status codes, response shape, meta inclusion
src/lib/skills/prerequisites.test.ts 11 getNextAchievableSkills — empty profile, foundation skills, prerequisite gating, level exclusion, multi-prereq unlock, duplicate deduplication

Coverage Comparison

Metric Before After
Test files 63 66 (+3)
Passing tests 1025 1070 (+45)

Note: The 10 pre-existing failures in src/lib/github/client.test.ts are unchanged — they were present before this PR and are related to missing GITHUB_TOKEN / gh auth in CI (tracked in #55).

Test approach

  • AAA pattern throughout
  • it.each for all multi-case scenarios (invalid inputs, edge values)
  • Tests are colocated next to source files following repo convention
  • response-utils tests exercise actual NextResponse (no mocking needed — NextResponse.json works in jsdom via Next.js polyfills)

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.

…uisites

- src/lib/api/validation-utils.test.ts: 21 tests for validateObject and
  validateRequiredString covering null/undefined/wrong-type inputs,
  whitespace-only strings, and custom fieldName messages.

- src/lib/api/response-utils.test.ts: 15 tests for apiSuccess,
  validationErrorResponse, and serviceUnavailableResponse covering
  status codes, response shapes, meta inclusion/exclusion.

- src/lib/skills/prerequisites.test.ts: 11 tests for
  getNextAchievableSkills covering empty profiles, foundation skills,
  prerequisite gating, intermediate/advanced exclusion, multi-prereq
  unlocking (react, nextjs, ci-cd), and duplicate skill deduplication.

45 new passing tests. No regressions.

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.

0 participants