mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 06:04:05 +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: {
|
runtime: {
|
||||||
actualStart: 150,
|
actualStart: 150,
|
||||||
|
plannedStart: 100,
|
||||||
},
|
},
|
||||||
} as RuntimeState;
|
} as RuntimeState;
|
||||||
|
|
||||||
@@ -760,6 +761,7 @@ describe('getRuntimeOffset()', () => {
|
|||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
actualStart: 150,
|
actualStart: 150,
|
||||||
|
plannedStart: 100,
|
||||||
},
|
},
|
||||||
} as RuntimeState;
|
} as RuntimeState;
|
||||||
|
|
||||||
@@ -784,6 +786,7 @@ describe('getRuntimeOffset()', () => {
|
|||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
actualStart: 100,
|
actualStart: 100,
|
||||||
|
plannedStart: 100,
|
||||||
},
|
},
|
||||||
} as RuntimeState;
|
} as RuntimeState;
|
||||||
|
|
||||||
@@ -809,6 +812,7 @@ describe('getRuntimeOffset()', () => {
|
|||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
actualStart: 100,
|
actualStart: 100,
|
||||||
|
plannedStart: 100,
|
||||||
},
|
},
|
||||||
} as RuntimeState;
|
} as RuntimeState;
|
||||||
|
|
||||||
|
|||||||
@@ -122,19 +122,18 @@ export function getRuntimeOffset(state: RuntimeState): { absoluteOffset: number;
|
|||||||
return { absoluteOffset: 0, relativeOffset: 0 };
|
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 { clock } = state;
|
||||||
const { countToEnd, timeStart } = state.eventNow;
|
const { countToEnd, timeStart } = state.eventNow;
|
||||||
const { addedTime, current, startedAt } = state.timer;
|
const { addedTime, current, startedAt } = state.timer;
|
||||||
const { actualStart, plannedStart } = state.runtime;
|
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
|
// if we havent started, but the timer is armed
|
||||||
// the offset is the difference to the schedule
|
// the offset is the difference to the schedule
|
||||||
if (startedAt === null) {
|
if (startedAt === null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user