Skip to content

test(replay): comprehensive replay engine tests#74

Merged
sepehr-safari merged 1 commit into
mainfrom
feat/replay-engine-tests
Jul 8, 2026
Merged

test(replay): comprehensive replay engine tests#74
sepehr-safari merged 1 commit into
mainfrom
feat/replay-engine-tests

Conversation

@sepehr-safari

Copy link
Copy Markdown
Member

Summary

Adds comprehensive test coverage for the replay engine (packages/toolkit/src/replay/engine.ts), addressing GitHub Issue #61.

What's Tested

55 tests across 9 describe blocks covering all public API surface:

  • Constructionnew ReplayEngine(events, failures, options), immutability of input arrays
  • totalEvents getter — correct count for normal, empty, and single-event cases
  • current getter — starts at 0, returns -1 for empty, advances after step(), reflects startIndex
  • step() — returns first/next event, returns null when complete, includes empty failures array, returns {event, failures, index}
  • stepBack() — returns null at start and after single step, goes back one event
  • jumpTo(index) — jumps to valid index, returns null for negative/out-of-range/empty
  • getState() — returns played/remaining/complete snapshot, includes failures in played events, handles empty
  • reset() — returns to index 0, allows re-stepping, handles empty
  • Failures filtering — only failures matching current event's id returned via step() and in getState().played
  • Edge cases — empty events array, single event, options.startIndex (at start, mid, last, default)

Test Pattern

Uses the same makeEvent helper pattern as packages/toolkit/src/core/detection.test.ts, with a local makeFailure helper for building Failure objects. Imports from ./engine.js as specified.

Checklist

  • pnpm test — 280 tests pass (55 new)
  • pnpm lint — clean
  • pnpm typecheck — clean
  • pnpm format — clean

Closes #61

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ocpp-debugkit-web Ready Ready Preview, Comment Jul 8, 2026 5:45pm

@sepehr-safari sepehr-safari merged commit d60dc17 into main Jul 8, 2026
4 checks passed
@sepehr-safari sepehr-safari deleted the feat/replay-engine-tests branch July 8, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(replay): replay engine implementation + tests

1 participant