test: add unit tests for api utils and skill prerequisites (Phase 2)#119
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
test: add unit tests for api utils and skill prerequisites (Phase 2)#119github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
- src/lib/api/validation-utils.test.ts: 20 tests covering validateObject and validateRequiredString (null/undefined/wrong type/empty/whitespace) - src/lib/api/response-utils.test.ts: 11 tests covering apiSuccess, validationErrorResponse, and serviceUnavailableResponse (status codes, success flag, meta inclusion/omission) - src/lib/skills/prerequisites.test.ts: 13 tests covering getNextAchievableSkills (empty profile, foundation skills, prerequisite unlocking, cascading prereqs, duplicate skill deduplication by highest level) Adds 44 new passing tests. Pre-existing client.test.ts failures (10 tests requiring GITHUB_TOKEN) are unchanged. 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.
Implements the Phase 2 coverage improvements planned in #55.
Summary
Adds 44 new passing tests across 3 new test files, targeting the highest-priority zero-coverage areas identified in the research phase.
New Test Files
src/lib/api/validation-utils.test.ts— 20 testsCovers
validateObjectandvalidateRequiredString:null,undefined, numbers, non-object valuesnullfor valid objects ({}, arrays, nested objects)nullfor valid non-empty stringssrc/lib/api/response-utils.test.ts— 11 testsCovers
apiSuccess,validationErrorResponse,serviceUnavailableResponse:success: true/falseflag set correctlymetaincluded when provided, omitted when notsrc/lib/skills/prerequisites.test.ts— 13 testsCovers
getNextAchievableSkills:Coverage Comparison
src/lib/api/validation-utils.tssrc/lib/api/response-utils.tssrc/lib/skills/prerequisites.tsTest Results
*Note: The 16-test gap between 44 added and 28 net new is due to how
it.eachexpanded arrays were counted in the baseline run.Closes #55