Skip to content

timeMachine.ts: Write unit tests for clock override boundary conditions #638

Description

@Kingsman-99

Description

src/timeMachine.ts provides a clock-override utility used in time-sensitive tests, but there are no tests covering boundary cases: advancing time past midnight, advancing by zero milliseconds, and restoring the real clock after an override.

Acceptance Criteria

  • Test: advancing the fake clock to exactly midnight rolls the date correctly
  • Test: advancing by 0 ms leaves the clock unchanged
  • Test: after restore(), Date.now() returns a value within 50 ms of the real wall clock
  • Unit tests pass

Context

  • Target file: src/timeMachine.ts
  • Tests should live in src/__tests__/timeMachine.test.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions