Skip to content

Commit

Permalink
useFakeTimers for initRundown in tests (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-Arc authored Jul 22, 2024
1 parent a7fe5ec commit 91d6adf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/server/src/stores/__tests__/runtimeState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('mutation on runtimeState', () => {
vi.clearAllMocks();
});

describe('playback operations', () => {
describe('playback operations', async () => {
it('refuses if nothing is loaded', () => {
let success = start(mockState);
expect(success).toBe(false);
Expand Down Expand Up @@ -159,8 +159,12 @@ describe('mutation on runtimeState', () => {
const event1 = { ...mockEvent, id: 'event1', timeStart: 0, timeEnd: 1000, duration: 1000 };
const event2 = { ...mockEvent, id: 'event2', timeStart: 1000, timeEnd: 1500, duration: 500 };
// force update
initRundown([event1, event2], {});
test('runtime offset', () => {
vi.useFakeTimers();
await initRundown([event1, event2], {});
vi.runAllTimers();
vi.useRealTimers();

test('runtime offset', async () => {
// 1. Load event
load(event1, [event1, event2]);
let newState = getState();
Expand Down

0 comments on commit 91d6adf

Please sign in to comment.