Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(testing): remove FakeTime.start setter #5050

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions testing/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ let dueTree: RedBlackTree<DueNode>;
* Overrides the real Date object and timer functions with fake ones that can be
* controlled through the fake time instance.
*
* Note: there is no setter for the `start` property, as it cannot be changed
* after initialization.
*
* @example Usage
* ```ts
* import {
Expand Down Expand Up @@ -535,24 +538,6 @@ export class FakeTime {
get start(): number {
return startedAt;
}
/** You can't set this property.
*
* @example Usage
* ```ts
* import { FakeTime } from "@std/testing/time";
* import { assertThrows } from "@std/assert/assert-throws";
*
* const fakeTime = new FakeTime(15_000);
*
* assertThrows(() => {
* fakeTime.start = 20_000;
* }, Error)
* ```
* @param value The value to set
*/
set start(value: number) {
throw new Error("cannot change start time after initialization");
}

/**
* Resolves after the given number of milliseconds using real time.
Expand Down