refactor: delete several events

This commit is contained in:
Carlos Valente
2024-05-24 11:38:54 +02:00
committed by Carlos Valente
parent 16f31a07b7
commit a09aa922bb
14 changed files with 84 additions and 35 deletions
@@ -347,9 +347,22 @@ describe('remove() mutation', () => {
test('deletes an event from the rundown', () => {
const mockEvent = { id: 'mock', cue: 'mock', type: SupportedEvent.Event } as OntimeEvent;
const testRundown: OntimeRundown = [mockEvent];
const { newRundown } = remove({ eventId: mockEvent.id, persistedRundown: testRundown });
const { newRundown } = remove({ eventIds: [mockEvent.id], persistedRundown: testRundown });
expect(newRundown.length).toBe(0);
});
test('deletes multiple events from the rundown', () => {
const testRundown: OntimeRundown = [
{ type: SupportedEvent.Event, id: '1' } as OntimeEvent,
{ type: SupportedEvent.Block, id: '2' } as OntimeBlock,
{ type: SupportedEvent.Delay, id: '3' } as OntimeDelay,
{ type: SupportedEvent.Event, id: '4' } as OntimeEvent,
{ type: SupportedEvent.Event, id: '5' } as OntimeEvent,
{ type: SupportedEvent.Event, id: '6' } as OntimeEvent,
];
const { newRundown } = remove({ eventIds: ['1', '2', '3'], persistedRundown: testRundown });
expect(newRundown.length).toBe(3);
expect(newRundown.at(0).id).toBe('4');
});
});
describe('edit() mutation', () => {