mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 05:13:32 +00:00
Deps migration (#1988)
* chore: migrate eslint to oxlint * chore: migrate prettier to oxfmt * chore: migrate typescript * chore: toThrow should have a expected value * chore: cast test value as Day * chore: small title fix * chore: mocks should be hoisted * chore: incorrect async useage * chore: test should be inside description * chore: test sohuld include an expeced * chore: oxfmt --------- Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
import { dayInMs, MILLIS_PER_HOUR, MILLIS_PER_MINUTE } from 'ontime-utils';
|
||||
|
||||
import { PlayableEvent } from 'ontime-types';
|
||||
import { MILLIS_PER_HOUR, MILLIS_PER_MINUTE, dayInMs } from 'ontime-utils';
|
||||
|
||||
import { initRundown } from '../../api-data/rundown/rundown.service.js';
|
||||
import { processRundown, rundownCache } from '../../api-data/rundown/rundown.dao.js';
|
||||
import { makeOntimeEvent, makeRundown } from '../../api-data/rundown/__mocks__/rundown.mocks.js';
|
||||
|
||||
import { processRundown, rundownCache } from '../../api-data/rundown/rundown.dao.js';
|
||||
import { initRundown } from '../../api-data/rundown/rundown.service.js';
|
||||
import { loadRoll } from '../rollUtils.js';
|
||||
|
||||
beforeAll(() => {
|
||||
vi.mock('../../classes/data-provider/DataProvider.js', () => {
|
||||
return {
|
||||
getDataProvider: vi.fn().mockImplementation(() => {
|
||||
return {
|
||||
setCustomFields: vi.fn().mockImplementation((newData) => newData),
|
||||
setRundown: vi.fn().mockImplementation((newData) => newData),
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
vi.mock('../../classes/data-provider/DataProvider.js', () => {
|
||||
return {
|
||||
getDataProvider: vi.fn().mockImplementation(() => {
|
||||
return {
|
||||
setCustomFields: vi.fn().mockImplementation((newData) => newData),
|
||||
setRundown: vi.fn().mockImplementation((newData) => newData),
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
const mockEvent = {
|
||||
@@ -727,7 +723,7 @@ describe('loadRoll() test that roll behaviour multi day event edge cases', () =>
|
||||
id: '2',
|
||||
timeStart: 11 * MILLIS_PER_HOUR,
|
||||
timeEnd: 2 * MILLIS_PER_HOUR,
|
||||
duration: 14 * MILLIS_PER_HOUR
|
||||
duration: 14 * MILLIS_PER_HOUR,
|
||||
},
|
||||
},
|
||||
}),
|
||||
@@ -782,7 +778,7 @@ describe('loadRoll() test that roll behaviour multi day event edge cases', () =>
|
||||
});
|
||||
|
||||
describe('loadRoll() should not roll skipped events', () => {
|
||||
test('', async () => {
|
||||
test('load roll', async () => {
|
||||
vi.useFakeTimers();
|
||||
await initRundown(
|
||||
makeRundown({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { dayInMs, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, millisToString } from 'ontime-utils';
|
||||
import { EndAction, Playback, TimeOfDay, TimeStrategy, TimerPhase, TimerType } from 'ontime-types';
|
||||
import { MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, dayInMs, millisToString } from 'ontime-utils';
|
||||
|
||||
import type { RuntimeState } from '../../stores/runtimeState.js';
|
||||
import {
|
||||
findDayOffset,
|
||||
getCurrent,
|
||||
@@ -11,7 +12,8 @@ import {
|
||||
normaliseEndTime,
|
||||
skippedOutOfEvent,
|
||||
} from '../timerUtils.js';
|
||||
import type { RuntimeState } from '../../stores/runtimeState.js';
|
||||
|
||||
const asTimeOfDay = (value: number): RuntimeState['clock'] => value as RuntimeState['clock'];
|
||||
|
||||
describe('getExpectedFinish()', () => {
|
||||
it('is null if we havent started', () => {
|
||||
@@ -574,7 +576,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock += testSkipLimit;
|
||||
state.clock = asTimeOfDay(state.clock + testSkipLimit);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -594,7 +596,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock += testSkipLimit;
|
||||
state.clock = asTimeOfDay(state.clock + testSkipLimit);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -613,7 +615,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock = testSkipLimit - 2;
|
||||
state.clock = asTimeOfDay(testSkipLimit - 2);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -632,7 +634,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock -= testSkipLimit;
|
||||
state.clock = asTimeOfDay(state.clock - testSkipLimit);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -652,7 +654,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock += testSkipLimit + 1;
|
||||
state.clock = asTimeOfDay(state.clock + testSkipLimit + 1);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -672,7 +674,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock -= testSkipLimit + 1;
|
||||
state.clock = asTimeOfDay(state.clock - testSkipLimit - 1);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -691,7 +693,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock = testSkipLimit - 2;
|
||||
state.clock = asTimeOfDay(testSkipLimit - 2);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -710,7 +712,7 @@ describe('skippedOutOfEvent()', () => {
|
||||
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(false);
|
||||
|
||||
state.clock -= testSkipLimit + 1;
|
||||
state.clock = asTimeOfDay(state.clock - testSkipLimit - 1);
|
||||
expect(skippedOutOfEvent(state, previousTime, testSkipLimit)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -1253,7 +1255,7 @@ describe('getTimerPhase()', () => {
|
||||
expect(phase).toBe(TimerPhase.Warning);
|
||||
});
|
||||
|
||||
it('it default if the timer is playing and there is none of the above', () => {
|
||||
it('is default if the timer is playing and there is none of the above', () => {
|
||||
const state = {
|
||||
timer: {
|
||||
addedTime: 0,
|
||||
|
||||
Reference in New Issue
Block a user