Repository navigation
[26/N] Add unit tests for LinkedList, DoublyLinkedList, and CircularlyLinkedList algorithms - #117
Open
karkir0003 wants to merge 26 commits into
Conversation
…de, and AnimatedCircularlyLinkedListNode
This was referenced Oct 3, 2026
This was referenced Oct 3, 2026
This branch has not been deployed
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.
🥞 Stack
Addresses #93
Context
Adds comprehensive unit test coverage for the linked list algorithm visualizers:
•
LinkedList.js: Singly linked list operations (add/remove head, tail, arbitrary index, traversal).•
DoublyLinkedList.js: Doubly linked list operations (next/prev pointer manipulation, bidirectional traversal, edge cases).•
CircularlyLinkedList.js: Circularly linked list operations (circular pointer maintenance, rotation, single-node and multi-node insertions/removals).Changes Made
• Introduced
src/algo/__tests__/LinkedList.test.js:• Control registration (
addControls, input fields, action buttons,disableUI/enableUI).•
addoperations (front, back, middle index) with head/tail updates and size limits.•
removeoperations (front, back, middle index) with empty list checks, single element handling, and pointer updates.• Validation (invalid/out-of-bounds inputs, empty values, capacity constraints).
•
reset,clearAll,randomCallback, and URL parameter serialization (setURLData).• Introduced
src/algo/__tests__/DoublyLinkedList.test.js:• Control registration and UI toggle states.
• Bidirectional
addoperations (front, back, indexed insertion) with next and prev pointer rewiring.•
removeoperations (head, tail, arbitrary index) with empty and single-element edge case checks.• Pointer integrity assertions, bounds checks, random generation, and clear routines.
• Introduced
src/algo/__tests__/CircularlyLinkedList.test.js:• Circular pointer setup and UI controls initialization.
•
addoperations (front, back, arbitrary index) verifying circular pointer loops back to head.•
removeoperations (front, back, index) asserting circular pointer integrity upon deletion.• Edge cases: single element removal restoring empty state, full list cap, validation errors, reset, and URL data.
Test Plan
• Ran
npm test -- --watchAll=false(all 37 test suites pass, 365 tests passing).• Ran
npm run lintandnpm run prettier(0 errors, 0 warnings).