refactor: rundown service fetches data from data provider (#752)

This commit is contained in:
Carlos Valente
2024-01-31 19:30:44 +01:00
committed by GitHub
parent cf08bfc796
commit 91fd275564
9 changed files with 133 additions and 146 deletions
@@ -48,18 +48,16 @@ describe('mutation on runtimeState', () => {
beforeEach(() => {
clear();
vi.mock('../../classes/event-loader/EventLoader.js', () => ({
EventLoader: {
getPlayableEvents: vi.fn().mockReturnValue([
{
id: 'mock',
cue: 'mock',
timeStart: 0,
timeEnd: 1000,
duration: 1000,
},
]),
},
vi.mock('../../services/rundown-service/RundownService.js', () => ({
getPlayableEvents: vi.fn().mockReturnValue([
{
id: 'mock',
cue: 'mock',
timeStart: 0,
timeEnd: 1000,
duration: 1000,
},
]),
}));
});
+2 -2
View File
@@ -3,8 +3,8 @@ import { calculateDuration, dayInMs } from 'ontime-utils';
import { clock } from '../services/Clock.js';
import { RestorePoint } from '../services/RestoreService.js';
import { getPlayableEvents } from '../services/rundown-service/RundownService.js';
import { getCurrent, getExpectedFinish, getRollTimers, skippedOutOfEvent, updateRoll } from '../services/timerUtils.js';
import { EventLoader } from '../classes/event-loader/EventLoader.js';
import { timerConfig } from '../config/config.js';
const initialRuntime: Runtime = {
@@ -102,7 +102,7 @@ function patchTimer(newState: Partial<TimerState>) {
*/
function fetchNumEvents(): number {
// TODO: could we avoid having this dependency?
return EventLoader.getPlayableEvents().length;
return getPlayableEvents().length;
}
/**