test: add unit tests for API utils and skill prerequisites (Phase 2)#103
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
test: add unit tests for API utils and skill prerequisites (Phase 2)#103github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Add 52 new unit tests across 3 files: - src/lib/api/validation-utils.test.ts (28 tests) - validateObject: null/undefined/number/string/bool/valid object - validateRequiredString: null/undefined/empty/whitespace/valid - src/lib/api/response-utils.test.ts (11 tests) - apiSuccess: data, meta, no-meta, array, null data - validationErrorResponse: 400 status, with/without meta - serviceUnavailableResponse: 503 status, with/without meta - src/lib/skills/prerequisites.test.ts (13 tests) - Empty profile returns only foundation skills - Prerequisites unlock skills correctly - Multi-prereq skills (react, ci-cd) require all deps - Already-intermediate/advanced skills are excluded - Duplicate skill entries use highest level - SKILL_PREREQUISITES data integrity checks 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.
Summary
Phase 2 of the Daily Test Coverage Improver plan. Implements the top 3 priorities from the research issue.
New Test Files
src/lib/api/validation-utils.test.ts— 28 testsTests for
validateObjectandvalidateRequiredString:null,undefined, numbers, strings, booleansfieldNameappears in error messagesvalidateRequiredStringsrc/lib/api/response-utils.test.ts— 11 testsTests for
apiSuccess,validationErrorResponse,serviceUnavailableResponse:success: true/falsefield set correctlymetaincluded only when providedvi.mock('next/server')to isolate from Next.js runtimesrc/lib/skills/prerequisites.test.ts— 13 testsTests for
getNextAchievableSkills(complex pure function):SKILL_PREREQUISITESdata integrity: unique IDs, no unknown prerequisite referencesCoverage Improvement
src/lib/api/validation-utils.tssrc/lib/api/response-utils.tssrc/lib/skills/prerequisites.tsTest Results
Full suite: 1077 passing (up from ~1041), 10 pre-existing failures in
client.test.tsunchanged (token mocking issue tracked separately).Notes
describe/itblocks,it.eachfor table-driven cases, AAA patternclient.test.tsfailures are unrelated to these changes (missinggh authin CI)