Skip to content

feat(mock): add deterministic clock control and error simulation to mock generators - #981

Open
area523ufo wants to merge 1 commit into
Sorokit:mainfrom
area523ufo:feat/deterministic-mock-clock-errors-975
Open

area523ufo wants to merge 1 commit into
Sorokit:mainfrom
area523ufo:feat/deterministic-mock-clock-errors-975

Conversation

@area523ufo

Copy link
Copy Markdown

Summary

Extends src/lib/deterministic-mock.ts with deterministic clock control (createMockClock) and seeded/scheduled error simulation (createMockErrorGenerator) so tests can exercise time-dependent UI states and retry/failure paths deterministically.

Changes

  • Added createMockClock(initialMs?, stepMs?) with now(), advance(ms), set(ms), tick(steps?), iso(), and reset().
  • Added createMockErrorGenerator(seed, config) supporting deterministic failureRate, explicit failOnCalls indices, custom error messages/codes, and maybeThrow().
  • Extended generateMockTransactions and generateMockAssets options to accept a clock instance for reproducible timestamps.
  • Expanded src/lib/deterministic-mock.test.ts (20/20 unit tests passing).

Closes #975

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.

Support deterministic error injection and mock clock in deterministic-mock.ts

1 participant