@@ -476,7 +476,8 @@ describe('cronjobs', () => {
476476 expect ( await Snapshots . findOneAsync ( snapshot1 ) ) . toBeUndefined ( )
477477 } )
478478 async function insertPlayoutDevice (
479- props : Pick < PeripheralDevice , 'subType' | 'deviceName' | 'lastSeen' | 'parentDeviceId' >
479+ props : Pick < PeripheralDevice , 'subType' | 'deviceName' | 'lastSeen' | 'parentDeviceId' > &
480+ Partial < Pick < PeripheralDevice , 'token' > >
480481 ) : Promise < PeripheralDeviceId > {
481482 const deviceId = protectString < PeripheralDeviceId > ( getRandomString ( ) )
482483 await PeripheralDevices . insertAsync ( {
@@ -505,37 +506,43 @@ describe('cronjobs', () => {
505506 }
506507
507508 async function createMockPlayoutGatewayAndDevices ( lastSeen : number ) : Promise < {
509+ deviceToken : string
508510 mockPlayoutGw : PeripheralDeviceId
509511 mockCasparCg : PeripheralDeviceId
510512 mockAtem : PeripheralDeviceId
511513 } > {
514+ const deviceToken = 'token1'
512515 const mockPlayoutGw = await insertPlayoutDevice ( {
513516 deviceName : 'Playout Gateway' ,
514517 lastSeen : lastSeen ,
515518 subType : PERIPHERAL_SUBTYPE_PROCESS ,
519+ token : deviceToken ,
516520 } )
517521 const mockCasparCg = await insertPlayoutDevice ( {
518522 deviceName : 'CasparCG' ,
519523 lastSeen : lastSeen ,
520524 subType : TSR . DeviceType . CASPARCG ,
521525 parentDeviceId : mockPlayoutGw ,
526+ token : deviceToken ,
522527 } )
523528 const mockAtem = await insertPlayoutDevice ( {
524529 deviceName : 'ATEM' ,
525530 lastSeen : lastSeen ,
526531 subType : TSR . DeviceType . ATEM ,
527532 parentDeviceId : mockPlayoutGw ,
533+ token : deviceToken ,
528534 } )
529535
530536 return {
537+ deviceToken,
531538 mockPlayoutGw,
532539 mockCasparCg,
533540 mockAtem,
534541 }
535542 }
536543
537544 test ( 'Attempts to restart CasparCG when job is enabled' , async ( ) => {
538- const { mockCasparCg } = await createMockPlayoutGatewayAndDevices ( Date . now ( ) ) // Some time after the threshold
545+ const { mockCasparCg, deviceToken } = await createMockPlayoutGatewayAndDevices ( Date . now ( ) ) // Some time after the threshold
539546
540547 ; ( logger . info as jest . Mock ) . mockClear ( )
541548 // set time to 2020/07/{date} 04:05 Local Time, should be more than 24 hours after 2020/07/19 00:00 UTC
@@ -558,7 +565,7 @@ describe('cronjobs', () => {
558565 Meteor . callAsync (
559566 'peripheralDevice.functionReply' ,
560567 cmd . deviceId , // deviceId
561- '' , // deviceToken
568+ deviceToken , // deviceToken
562569 cmd . _id , // commandId
563570 null , // err
564571 null // result
0 commit comments