test: add algorithm unit tests and enforce 85% coverage gate#4
Merged
beingmartinbmc merged 1 commit intoJun 12, 2026
Conversation
- Add generator and randomInput test suites (previously 0% covered) - Add sorting, linked-list, graph pathfinding, and tree traversal tests - Remove dead branch in dijkstra; annotate defensive stale-heap guards - Configure vitest v8 coverage thresholds (85% across all metrics) - Run test:coverage in CI between typecheck and build All algorithm folders now >90% coverage (graph 100%).
beingmartinbmc
added a commit
that referenced
this pull request
Jul 5, 2026
…gate test: add algorithm unit tests and enforce 85% coverage gate
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
Adds the missing algorithm unit tests, lifts all algorithm folders above 90% coverage, and wires an 85% coverage gate into CI.
Tests added
tree/algorithms/__tests__/generator.test.ts—generateRandomTree,getTreeNodes,getTreeEdges(node counts, value/id uniqueness, layout, n−1 edges, empty/edge cases). 0% → 100%.linked-list/algorithms/__tests__/randomInput.test.ts— every problem branch (×40 runs each to beat internalMath.random()), outputs fed back into the step builder, LRU/cycle/palindrome format checks. 0% → 100%.pathfinding.test.tswith large-open-grid, boxed-in start, and sealed-region cases.Source tweaks
dijkstra.ts(distance === Infinitybreak could never fire).dijkstra.ts/astar.tswith/* v8 ignore */(unreachable under uniform edge weights) → graph 100%.CI gate
vitest.config.ts:coverage.thresholdsof 85% for statements/branches/functions/lines.ci.yml: new "Tests + coverage (min 85%)" step between typecheck and build.Final coverage (171 tests passing)