mirror of
https://github.com/cpvalente/ontime.git
synced 2026-07-26 10:38:55 +00:00
assert non null and update test (#1604)
This commit is contained in:
committed by
arc-alex
parent
c9bf6d9812
commit
66cd1decde
@@ -737,6 +737,7 @@ describe('getRuntimeOffset()', () => {
|
||||
},
|
||||
runtime: {
|
||||
actualStart: 150,
|
||||
plannedStart: 100,
|
||||
},
|
||||
} as RuntimeState;
|
||||
|
||||
@@ -760,6 +761,7 @@ describe('getRuntimeOffset()', () => {
|
||||
},
|
||||
runtime: {
|
||||
actualStart: 150,
|
||||
plannedStart: 100,
|
||||
},
|
||||
} as RuntimeState;
|
||||
|
||||
@@ -784,6 +786,7 @@ describe('getRuntimeOffset()', () => {
|
||||
},
|
||||
runtime: {
|
||||
actualStart: 100,
|
||||
plannedStart: 100,
|
||||
},
|
||||
} as RuntimeState;
|
||||
|
||||
@@ -809,6 +812,7 @@ describe('getRuntimeOffset()', () => {
|
||||
},
|
||||
runtime: {
|
||||
actualStart: 100,
|
||||
plannedStart: 100,
|
||||
},
|
||||
} as RuntimeState;
|
||||
|
||||
|
||||
@@ -122,19 +122,18 @@ export function getRuntimeOffset(state: RuntimeState): { absoluteOffset: number;
|
||||
return { absoluteOffset: 0, relativeOffset: 0 };
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-labels -- dev code path
|
||||
DEV: {
|
||||
// we know current exists as long as eventNow exists
|
||||
if (state.timer.current === null) {
|
||||
throw new Error('timerUtils.calculate: current must be set');
|
||||
}
|
||||
}
|
||||
|
||||
const { clock } = state;
|
||||
const { countToEnd, timeStart } = state.eventNow;
|
||||
const { addedTime, current, startedAt } = state.timer;
|
||||
const { actualStart, plannedStart } = state.runtime;
|
||||
|
||||
// eslint-disable-next-line no-unused-labels -- dev code path
|
||||
DEV: {
|
||||
// we know current exists as long as eventNow exists
|
||||
if (current === null) throw new Error('timerUtils.getRuntimeOffset: state.timer.current must be set');
|
||||
if (plannedStart === null) throw new Error('timerUtils.getRuntimeOffset: state.runtime.plannedStart must be set');
|
||||
}
|
||||
|
||||
// if we havent started, but the timer is armed
|
||||
// the offset is the difference to the schedule
|
||||
if (startedAt === null) {
|
||||
|
||||
Reference in New Issue
Block a user