test: add unit tests for validation-utils, response-utils, and prerequisites#129
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
…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>
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.
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/andsrc/lib/skills/.Files Added
src/lib/api/validation-utils.test.tsvalidateObject,validateRequiredString— all branchessrc/lib/api/response-utils.test.tsapiSuccess,validationErrorResponse,serviceUnavailableResponse— status codes, response shape, meta inclusionsrc/lib/skills/prerequisites.test.tsgetNextAchievableSkills— empty profile, foundation skills, prerequisite gating, level exclusion, multi-prereq unlock, duplicate deduplicationCoverage Comparison
Test approach
it.eachfor all multi-case scenarios (invalid inputs, edge values)response-utilstests exercise actualNextResponse(no mocking needed —NextResponse.jsonworks in jsdom via Next.js polyfills)