add some unit tests to replayer

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 7938b3231c
commit 97f1c30a37
2 changed files with 204 additions and 1 deletions

View File

@@ -88,6 +88,7 @@ export class Replayer {
* @param timeOffset number
*/
public play(timeOffset = 0) {
this.timer.clear();
this.baselineTime = this.events[0].timestamp + timeOffset;
const actions = new Array<actionWithDelay>();
for (const event of this.events) {
@@ -113,7 +114,7 @@ export class Replayer {
const actions = new Array<actionWithDelay>();
for (const event of this.events) {
if (
event.timestamp < this.lastPlayedEvent.timestamp ||
event.timestamp <= this.lastPlayedEvent.timestamp ||
event === this.lastPlayedEvent
) {
continue;