Skip to content

Commit

Permalink
Add a test for the idea that emissions should be weakly ascending ove…
Browse files Browse the repository at this point in the history
…r the timestamp attribute
  • Loading branch information
eoghanmurray committed Jul 8, 2021
1 parent 4206903 commit 53c1b4e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function matchSnapshot(
* @param snapshots incrementalSnapshotEvent[]
*/
function stringifySnapshots(snapshots: eventWithTime[]): string {
let asc_time = 0;
return JSON.stringify(
snapshots
.filter((s) => {
Expand Down Expand Up @@ -99,6 +100,21 @@ function stringifySnapshots(snapshots: eventWithTime[]): string {
}
});
}
if (
s.type === EventType.IncrementalSnapshot &&
(s.data.source === IncrementalSource.MouseMove
|| s.data.source === IncrementalSource.TouchMove
|| s.data.source === IncrementalSource.Drag)
) {
s.data.positions.forEach((p) => {
let t = s.timestamp + p.timeOffset;
assert(asc_time <= t);
asc_time = t;
});
} else {
assert(asc_time <= s.timestamp);
asc_time = s.timestamp;
}
delete s.timestamp;
return s;
}),
Expand Down

0 comments on commit 53c1b4e

Please sign in to comment.