Skip to content

Latest commit

 

History

History
37 lines (34 loc) · 2.24 KB

TEST_INFRA.md

File metadata and controls

37 lines (34 loc) · 2.24 KB

E2E & Unit Test Infrastructure: AlgoViz Platform

Test Philosophy

  • Requirement-driven, deterministic verification.
  • Pure algorithm step generator verification independent of React DOM timers.
  • Playback engine state transition verification (forward, backward, pause, resume, speed, reset).
  • Edge-case robustness: empty inputs, single-element, duplicates, negative values, sorted arrays, reverse-sorted arrays, missing search targets.

Test Architecture

  • Test Framework: Vitest (vitest run)
  • Configuration: vitest.config.ts
  • Environment: Node.js (fast, deterministic pure state testing)
  • Location: src/__tests__/

Coverage Tiers & Goals

  1. Tier 1: Feature Coverage (Core Step Sequences):
    • Sorting: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, Radix, Bucket. Verifying proper sequence of compare, swap/move, and sorted steps.
    • Searching: Linear Search, Binary Search (with low/mid/high pointer updates), Jump Search, Interpolation Search, Exponential Search, Ternary Search.
    • Data Structures: Linked List insert/delete, Stack push/pop, Queue enqueue/dequeue, BST insert/search, Graph BFS/DFS/Dijkstra shortest path.
  2. Tier 2: Boundary & Corner Cases:
    • Empty input array []
    • Single-element array [42]
    • Array with all identical duplicate elements [5, 5, 5, 5, 5]
    • Array containing negative numbers [-10, 4, -2, 0, 15]
    • Already sorted array [1, 2, 3, 4, 5]
    • Reverse-sorted array [5, 4, 3, 2, 1]
    • Missing search target (not found condition, pointer exhaustion)
    • Zero-distance / disconnected graph nodes
  3. Tier 3: Playback Engine State Transitions:
    • Step forward: stepIndex increments, state matches step snapshot.
    • Step backward: stepIndex decrements, previous state snapshot is restored exactly.
    • Reset: resets stepIndex to 0, preserves custom user array input (does not overwrite with random array).
    • Speed adjustment: alters interval without disturbing current step or mutating array state.
  4. Tier 4: End-to-End Application Integrity:
    • npm run build succeeds generating all 35 static routes with 0 errors.
    • npm run lint finishes with 0 errors and 0 warnings (no unhandled exhaustive-deps).
    • TypeScript compilation check (tsc --noEmit).