mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
useFakeTimers for initRundown in tests (#1150)
This commit is contained in:
committed by
GitHub
parent
a7fe5eceef
commit
91d6adf8e0
@@ -83,7 +83,7 @@ describe('mutation on runtimeState', () => {
|
|||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('playback operations', () => {
|
describe('playback operations', async () => {
|
||||||
it('refuses if nothing is loaded', () => {
|
it('refuses if nothing is loaded', () => {
|
||||||
let success = start(mockState);
|
let success = start(mockState);
|
||||||
expect(success).toBe(false);
|
expect(success).toBe(false);
|
||||||
@@ -159,8 +159,12 @@ describe('mutation on runtimeState', () => {
|
|||||||
const event1 = { ...mockEvent, id: 'event1', timeStart: 0, timeEnd: 1000, duration: 1000 };
|
const event1 = { ...mockEvent, id: 'event1', timeStart: 0, timeEnd: 1000, duration: 1000 };
|
||||||
const event2 = { ...mockEvent, id: 'event2', timeStart: 1000, timeEnd: 1500, duration: 500 };
|
const event2 = { ...mockEvent, id: 'event2', timeStart: 1000, timeEnd: 1500, duration: 500 };
|
||||||
// force update
|
// force update
|
||||||
initRundown([event1, event2], {});
|
vi.useFakeTimers();
|
||||||
test('runtime offset', () => {
|
await initRundown([event1, event2], {});
|
||||||
|
vi.runAllTimers();
|
||||||
|
vi.useRealTimers();
|
||||||
|
|
||||||
|
test('runtime offset', async () => {
|
||||||
// 1. Load event
|
// 1. Load event
|
||||||
load(event1, [event1, event2]);
|
load(event1, [event1, event2]);
|
||||||
let newState = getState();
|
let newState = getState();
|
||||||
|
|||||||
Reference in New Issue
Block a user