mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 16:49:41 +00:00
fix event next (#1664)
This commit is contained in:
committed by
GitHub
parent
bf8ed8d017
commit
6711cdaf4f
@@ -87,7 +87,10 @@ describe('mutation on runtimeState', () => {
|
|||||||
|
|
||||||
test('normal playback cycle', async () => {
|
test('normal playback cycle', async () => {
|
||||||
// 1. Load event
|
// 1. Load event
|
||||||
const mockRundown = makeRundown({ entries: { [mockEvent.id]: mockEvent }, order: [mockEvent.id] });
|
const mockRundown = makeRundown({
|
||||||
|
entries: { [mockEvent.id]: mockEvent, event2: { ...mockEvent, id: 'event2' } },
|
||||||
|
order: [mockEvent.id, 'event2'],
|
||||||
|
});
|
||||||
// force update
|
// force update
|
||||||
vi.useFakeTimers();
|
vi.useFakeTimers();
|
||||||
await initRundown(mockRundown, {});
|
await initRundown(mockRundown, {});
|
||||||
@@ -98,6 +101,7 @@ describe('mutation on runtimeState', () => {
|
|||||||
load(mockEvent, rundown, metadata);
|
load(mockEvent, rundown, metadata);
|
||||||
let newState = getState();
|
let newState = getState();
|
||||||
expect(newState.eventNow?.id).toBe(mockEvent.id);
|
expect(newState.eventNow?.id).toBe(mockEvent.id);
|
||||||
|
expect(newState.eventNext?.id).toBe('event2');
|
||||||
expect(newState.timer.playback).toBe(Playback.Armed);
|
expect(newState.timer.playback).toBe(Playback.Armed);
|
||||||
expect(newState.clock).not.toBe(666);
|
expect(newState.clock).not.toBe(666);
|
||||||
expect(newState.currentBlock.block).toBeNull();
|
expect(newState.currentBlock.block).toBeNull();
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ export function loadNext(
|
|||||||
}
|
}
|
||||||
const nowPlayableIndex = getPlayableIndexFromTimedIndex(metadata, eventIndex);
|
const nowPlayableIndex = getPlayableIndexFromTimedIndex(metadata, eventIndex);
|
||||||
|
|
||||||
if (!nowPlayableIndex || nowPlayableIndex > metadata.playableEventOrder.length - 2) {
|
if (nowPlayableIndex === null || nowPlayableIndex > metadata.playableEventOrder.length - 2) {
|
||||||
// we cound not find the event now or the event now is the last playable event
|
// we cound not find the event now or the event now is the last playable event
|
||||||
runtimeState.eventNext = null;
|
runtimeState.eventNext = null;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user