Skip to content

Commit 1e574c6

Browse files
committed
refactor timestamp test to be slightly less flakey
1 parent be6b25a commit 1e574c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/tests/unit/timestamp.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { calculateCurrentPosition } from "../../timestamp";
44

55
describe("calculateCurrentPosition", () => {
66
it("should calculate the correct playback position", () => {
7-
expect(calculateCurrentPosition(dayjs(), dayjs(), 0)).toBeCloseTo(0);
8-
expect(calculateCurrentPosition(dayjs(), dayjs(), 1)).toBeCloseTo(1);
7+
const now = dayjs();
8+
expect(calculateCurrentPosition(now, now, 0)).toBeCloseTo(0);
9+
expect(calculateCurrentPosition(now, now, 1)).toBeCloseTo(1);
910
expect(
1011
calculateCurrentPosition(
1112
dayjs("8 Mar 2020 05:00:00 GMT"),

0 commit comments

Comments
 (0)