@@ -46,11 +46,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
4646 } )
4747 }
4848
49- function runAndTidyResult (
50- pieceInstances : PieceInstance [ ] ,
51- nowInPart : number | PartCurrentTimes ,
52- includeVirtual ?: boolean
53- ) {
49+ function runAndTidyResult ( pieceInstances : PieceInstance [ ] , partTimes : PartCurrentTimes , includeVirtual ?: boolean ) {
5450 const resolvedInstances = processAndPrunePieceInstanceTimings (
5551 {
5652 one : {
@@ -67,7 +63,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
6763 } ,
6864 } ,
6965 pieceInstances ,
70- typeof nowInPart === 'number' ? createPartCurrentTimes ( nowInPart , 0 ) : nowInPart , // nocommit - this is a hack to avoid changing tests
66+ partTimes ,
7167 undefined ,
7268 includeVirtual
7369 )
@@ -85,7 +81,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
8581 createPieceInstance ( 'two' , { start : 1000 } , 'two' , PieceLifespan . OutOnRundownEnd ) ,
8682 ]
8783
88- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
84+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
8985 expect ( resolvedInstances ) . toEqual ( [
9086 {
9187 _id : 'one' ,
@@ -107,7 +103,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
107103 createPieceInstance ( 'two' , { start : 1000 , duration : 5000 } , 'one' , PieceLifespan . OutOnRundownEnd ) ,
108104 ]
109105
110- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
106+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
111107 expect ( resolvedInstances ) . toEqual ( [
112108 {
113109 _id : 'one' ,
@@ -133,7 +129,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
133129 createPieceInstance ( 'five' , { start : 4000 } , 'one' , PieceLifespan . OutOnShowStyleEnd ) ,
134130 ]
135131
136- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
132+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
137133 expect ( resolvedInstances ) . toEqual ( [
138134 {
139135 _id : 'zero' ,
@@ -183,7 +179,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
183179 createPieceInstance ( 'zero' , { start : 6000 } , 'one' , PieceLifespan . OutOnShowStyleEnd , true ) ,
184180 ]
185181
186- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
182+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
187183 expect ( resolvedInstances ) . toEqual ( [
188184 {
189185 _id : 'zero' ,
@@ -215,7 +211,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
215211 createPieceInstance ( 'five' , { start : 6000 } , 'one' , PieceLifespan . OutOnShowStyleEnd , true ) ,
216212 ]
217213
218- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 , true )
214+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) , true )
219215 expect ( resolvedInstances ) . toEqual ( [
220216 {
221217 _id : 'zero' ,
@@ -265,7 +261,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
265261 createPieceInstance ( 'five' , { start : 6000 } , 'one' , PieceLifespan . OutOnShowStyleEnd ) ,
266262 ]
267263
268- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
264+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
269265 expect ( resolvedInstances ) . toEqual ( [
270266 {
271267 _id : 'zero' ,
@@ -311,7 +307,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
311307 createPieceInstance ( 'two' , { start : 1000 } , 'one' , PieceLifespan . OutOnSegmentEnd , 5500 ) ,
312308 ]
313309
314- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
310+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
315311 expect ( resolvedInstances ) . toEqual ( [
316312 {
317313 _id : 'one' ,
@@ -329,7 +325,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
329325 createPieceInstance ( 'four' , { start : 1000 } , 'one' , PieceLifespan . OutOnRundownChange , 4000 ) ,
330326 ]
331327
332- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
328+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
333329 expect ( resolvedInstances ) . toEqual ( [
334330 {
335331 _id : 'three' ,
@@ -345,7 +341,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
345341 createPieceInstance ( 'two' , { start : 1000 } , 'one' , PieceLifespan . OutOnShowStyleEnd , 5500 ) ,
346342 ]
347343
348- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
344+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
349345 expect ( resolvedInstances ) . toEqual ( [
350346 {
351347 _id : 'one' ,
@@ -372,7 +368,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
372368 } ) ,
373369 ]
374370
375- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
371+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
376372 expect ( resolvedInstances ) . toEqual ( [
377373 {
378374 _id : 'one' ,
@@ -405,7 +401,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
405401 } ) ,
406402 ]
407403
408- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
404+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
409405 expect ( resolvedInstances ) . toEqual ( [
410406 {
411407 _id : 'two' ,
@@ -433,7 +429,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
433429
434430 pieceInstances [ 1 ] . piece . virtual = true
435431
436- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
432+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
437433
438434 // don't expect virtual Pieces in the results, but 'one' should be pruned too
439435 expect ( resolvedInstances ) . toEqual ( [ ] )
@@ -463,7 +459,7 @@ describe('processAndPrunePieceInstanceTimings', () => {
463459 pieceInstances [ 0 ] . piece . prerollDuration = 200
464460 pieceInstances [ 1 ] . piece . prerollDuration = 200
465461
466- const resolvedInstances = runAndTidyResult ( pieceInstances , 500 )
462+ const resolvedInstances = runAndTidyResult ( pieceInstances , createPartCurrentTimes ( 500 , 0 ) )
467463
468464 expect ( resolvedInstances ) . toEqual ( [
469465 {
0 commit comments