mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 10:53:51 +00:00
release test fixes (#496)
* refactor: handle missing type * fix: prevent stale data on cancel delay
This commit is contained in:
@@ -132,12 +132,13 @@ export async function cachedDelete(eventId: string) {
|
||||
}
|
||||
|
||||
let updatedRundown = DataProvider.getRundown();
|
||||
const eventBack = { ...updatedRundown[eventIndex] };
|
||||
updatedRundown = deleteAtIndex(eventIndex, updatedRundown);
|
||||
if (eventId !== delayedRundown[eventIndex].id) {
|
||||
invalidateFromError();
|
||||
} else {
|
||||
delayedRundown = deleteAtIndex(eventIndex, delayedRundown);
|
||||
if (isOntimeDelay(updatedRundown[eventIndex]) || isOntimeBlock(updatedRundown[eventIndex])) {
|
||||
if (isOntimeDelay(eventBack) || isOntimeBlock(eventBack)) {
|
||||
// for events, we do not have to worry
|
||||
// the following event, would have taken the place of the deleted event by now
|
||||
delayedRundown = calculateRuntimeDelaysFromIndex(eventIndex, delayedRundown);
|
||||
|
||||
@@ -47,6 +47,7 @@ test('delay blocks add time to events', async ({ page }) => {
|
||||
// cancel delay
|
||||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
await expect(page.getByTestId('panel-rundown').getByTestId('time-input-timeStart')).toHaveValue('00:08:00');
|
||||
await expect(page.getByText('+10 minNew start: 00:18:00')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('delays are show correctly', async ({ page }) => {
|
||||
|
||||
@@ -2,13 +2,13 @@ import { OntimeRundownEntry } from '../definitions/core/Rundown.type.js';
|
||||
import { OntimeBlock, OntimeDelay, OntimeEvent, SupportedEvent } from '../definitions/core/OntimeEvent.type.js';
|
||||
|
||||
export function isOntimeEvent(event: OntimeRundownEntry | Partial<OntimeRundownEntry>): event is OntimeEvent {
|
||||
return event.type === SupportedEvent.Event;
|
||||
return event?.type === SupportedEvent.Event;
|
||||
}
|
||||
|
||||
export function isOntimeDelay(event: OntimeRundownEntry | Partial<OntimeRundownEntry>): event is OntimeDelay {
|
||||
return event.type === SupportedEvent.Delay;
|
||||
return event?.type === SupportedEvent.Delay;
|
||||
}
|
||||
|
||||
export function isOntimeBlock(event: OntimeRundownEntry | Partial<OntimeRundownEntry>): event is OntimeBlock {
|
||||
return event.type === SupportedEvent.Block;
|
||||
return event?.type === SupportedEvent.Block;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user