mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 08:39:34 +00:00
chore: forgiving test
This commit is contained in:
committed by
Carlos Valente
parent
ac430602b4
commit
4069038ed5
@@ -168,7 +168,11 @@ describe('mutation on runtimeState', () => {
|
|||||||
load(event2, [event1, event2]);
|
load(event2, [event1, event2]);
|
||||||
start();
|
start();
|
||||||
newState = getState();
|
newState = getState();
|
||||||
expect(newState.runtime.actualStart).toBeCloseTo(firstStart, 0);
|
|
||||||
|
// there is a case where the calculation time overflows the millisecond which makes
|
||||||
|
// tests fail
|
||||||
|
const forgivingActualStart = Math.abs(newState.runtime.actualStart - firstStart);
|
||||||
|
expect(forgivingActualStart).toBeLessThanOrEqual(1);
|
||||||
// we are over-under, the difference between the schedule and the actual start
|
// we are over-under, the difference between the schedule and the actual start
|
||||||
const delayBefore = event2.timeStart - newState.clock;
|
const delayBefore = event2.timeStart - newState.clock;
|
||||||
expect(newState.runtime.offset).toBe(delayBefore);
|
expect(newState.runtime.offset).toBe(delayBefore);
|
||||||
|
|||||||
Reference in New Issue
Block a user