Skip to content

Commit 6189939

Browse files
committed
chore: use shared piece lifespan presets in the shadow virtual tests
1 parent 16ddae7 commit 6189939

3 files changed

Lines changed: 13 additions & 20 deletions

File tree

‎packages/corelib/src/playout/__tests__/infinites.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,9 @@ describe('Infinites', () => {
554554
const virtualEnder = (id: string, lifespan: IPieceLifespan) =>
555555
createPieceInstance({ ...createPiece(`${id}_end`, 'part1', 0, id, lifespan), virtual: true })
556556

557-
const legacyPersist: IPieceLifespan = { ...rundownPersist, inShadow: 'legacy-persist' }
558557
const playing = createPlaying('part1', [
559-
continuedAdlib('legacy', legacyPersist),
560-
virtualEnder('legacy', legacyPersist),
558+
continuedAdlib('legacy', rundownLegacy),
559+
virtualEnder('legacy', rundownLegacy),
561560
continuedAdlib('persist', rundownPersist),
562561
virtualEnder('persist', rundownPersist),
563562
])

‎packages/corelib/src/playout/__tests__/processAndPrune.test.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,9 @@ describe('processAndPrunePieceInstanceTimings', () => {
216216
fromPreviousPart: true,
217217
})
218218
const shadow = (enable: Piece['enable']): PieceInstance => {
219-
const instance = createPieceInstance('shadow', enable, 'one', {
220-
scope: 'part',
221-
presence: 'forward-scope',
222-
inShadow: 'stop',
223-
})
219+
const instance = createPieceInstance('shadow', enable, 'one', partOnlyLifespan)
224220
return { ...instance, piece: { ...instance.piece, virtual: true, virtualMode: 'shadow' } }
225221
}
226-
const rundownPersist: IPieceLifespan = { scope: 'rundown', presence: 'forward-scope', inShadow: 'persist' }
227222

228223
test('an adlib taken before a shadow stays under it, wherever the playhead is', () => {
229224
const adlib = {
@@ -292,7 +287,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
292287
test('a legacy-persist piece is cut by a shadow, and resumes after it', () => {
293288
const resolvedInstances = runAndTidyResult(
294289
[
295-
continuation('incoming', { ...rundownPersist, inShadow: 'legacy-persist' }),
290+
continuation('incoming', LEGACY_PIECE_LIFESPAN_PRESETS[LegacyPieceLifespan.OutOnRundownEnd]),
296291
shadow({ start: 2000, duration: 3000 }),
297292
],
298293
createPartCurrentTimes(500, 0)
@@ -348,8 +343,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
348343

349344
test('a clear virtual which does not end a persisting piece obstructs it while active, as a shadow', () => {
350345
const clear = createPieceInstance('clear', { start: 2000, duration: 3000 }, 'one', partOnlyLifespan, true)
351-
const segmentPersist: IPieceLifespan = { scope: 'segment', presence: 'forward-scope', inShadow: 'persist' }
352-
const legacyPersist: IPieceLifespan = { ...rundownPersist, inShadow: 'legacy-persist' }
346+
const legacyPersist = LEGACY_PIECE_LIFESPAN_PRESETS[LegacyPieceLifespan.OutOnRundownEnd]
353347

354348
expect(
355349
runAndTidyResult([continuation('incoming', segmentPersist), clear], createPartCurrentTimes(500, 0))

‎packages/job-worker/src/playout/__tests__/infinitesE2E.test.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import { sleep } from '@sofie-automation/shared-lib/dist/lib/lib'
2424
import { wrapDefaultObject } from '@sofie-automation/corelib/dist/settings/objectWithOverrides'
2525
import { IPieceLifespan } from '@sofie-automation/shared-lib/dist/core/model/Rundown'
2626
import { LegacyPieceLifespan } from '@sofie-automation/blueprints-integration'
27-
import { LEGACY_PIECE_LIFESPAN_PRESETS } from '@sofie-automation/corelib/dist/playout/pieceLifespan'
27+
import {
28+
DEFAULT_PIECE_LIFESPAN,
29+
LEGACY_PIECE_LIFESPAN_PRESETS,
30+
} from '@sofie-automation/corelib/dist/playout/pieceLifespan'
2831
import { adjustFakeTime, useFakeCurrentTime } from '../../__mocks__/time.js'
2932

3033
jest.spyOn(peripheralDeviceLib, 'executePeripheralDeviceFunction').mockImplementation(async () => sleep(10))
@@ -297,13 +300,10 @@ describe('Infinites through playout', () => {
297300
await take(playlistId)
298301

299302
for (const layer of ['layerS', 'layerP']) {
300-
await insertOnAir(
301-
playlistId,
302-
`Shadow ${layer}`,
303-
{ scope: 'part', presence: 'forward-scope', inShadow: 'stop' },
304-
layer,
305-
{ enable: { start: 'now', duration: 1000 }, virtualMode: 'shadow' }
306-
)
303+
await insertOnAir(playlistId, `Shadow ${layer}`, DEFAULT_PIECE_LIFESPAN, layer, {
304+
enable: { start: 'now', duration: 1000 },
305+
virtualMode: 'shadow',
306+
})
307307
}
308308

309309
const shadows = (await context.mockCollections.PieceInstances.findFetch()).filter((p) =>

0 commit comments

Comments
 (0)