test: add unit tests for API utils and skill prerequisites (Phase 2 retry)#108
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
test: add unit tests for API utils and skill prerequisites (Phase 2 retry)#108github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
…uisites Add 48 new unit tests across 3 files identified in issue #55: - src/lib/api/validation-utils.test.ts (23 tests) - validateObject: rejects null/undefined/primitives, accepts objects/arrays - validateRequiredString: rejects empty/whitespace/non-strings, accepts valid strings - src/lib/api/response-utils.test.ts (15 tests) - apiSuccess: correct shape with/without meta, no spurious keys - validationErrorResponse: status 400, correct error format - serviceUnavailableResponse: status 503, correct error format - src/lib/skills/prerequisites.test.ts (10 tests) - getNextAchievableSkills: empty profile, unmet prerequisites, level thresholds, multi-prerequisite skills, duplicate skill deduplication 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).
What changed
Added 48 new unit tests across 3 previously uncovered files:
src/lib/api/validation-utils.test.tsvalidateObject&validateRequiredStringsrc/lib/api/response-utils.test.tsapiSuccess,validationErrorResponse,serviceUnavailableResponsesrc/lib/skills/prerequisites.test.tsgetNextAchievableSkillsTest suite comparison
client.test.tstoken issue — unchanged)Coverage highlights
validation-utilsnull,undefined, numbers, booleans, strings forvalidateObjectvalidateRequiredStringvalidateObjectresponse-utilsNextResponseis mocked viavi.hoisted()+vi.mock('next/server')to inspect call argumentssuccess: true/success: falseshapemetais included only when provided (no spurious keys)prerequisitesintermediate/advancedexcluded from resultsnextjs,react) only unlock when all prereqs presentskillId,displayName,prerequisites[])