@@ -414,7 +414,8 @@ describe('cronjobs', () => {
414414 expect ( await Snapshots . findOneAsync ( snapshot1 ) ) . toBeUndefined ( )
415415 } )
416416 async function insertPlayoutDevice (
417- props : Pick < PeripheralDevice , 'subType' | 'deviceName' | 'lastSeen' | 'parentDeviceId' >
417+ props : Pick < PeripheralDevice , 'subType' | 'deviceName' | 'lastSeen' | 'parentDeviceId' > &
418+ Partial < Pick < PeripheralDevice , 'token' > >
418419 ) : Promise < PeripheralDeviceId > {
419420 const deviceId = protectString < PeripheralDeviceId > ( getRandomString ( ) )
420421 await PeripheralDevices . insertAsync ( {
@@ -443,37 +444,43 @@ describe('cronjobs', () => {
443444 }
444445
445446 async function createMockPlayoutGatewayAndDevices ( lastSeen : number ) : Promise < {
447+ deviceToken : string
446448 mockPlayoutGw : PeripheralDeviceId
447449 mockCasparCg : PeripheralDeviceId
448450 mockAtem : PeripheralDeviceId
449451 } > {
452+ const deviceToken = 'token1'
450453 const mockPlayoutGw = await insertPlayoutDevice ( {
451454 deviceName : 'Playout Gateway' ,
452455 lastSeen : lastSeen ,
453456 subType : PERIPHERAL_SUBTYPE_PROCESS ,
457+ token : deviceToken ,
454458 } )
455459 const mockCasparCg = await insertPlayoutDevice ( {
456460 deviceName : 'CasparCG' ,
457461 lastSeen : lastSeen ,
458462 subType : TSR . DeviceType . CASPARCG ,
459463 parentDeviceId : mockPlayoutGw ,
464+ token : deviceToken ,
460465 } )
461466 const mockAtem = await insertPlayoutDevice ( {
462467 deviceName : 'ATEM' ,
463468 lastSeen : lastSeen ,
464469 subType : TSR . DeviceType . ATEM ,
465470 parentDeviceId : mockPlayoutGw ,
471+ token : deviceToken ,
466472 } )
467473
468474 return {
475+ deviceToken,
469476 mockPlayoutGw,
470477 mockCasparCg,
471478 mockAtem,
472479 }
473480 }
474481
475482 test ( 'Attempts to restart CasparCG when job is enabled' , async ( ) => {
476- const { mockCasparCg } = await createMockPlayoutGatewayAndDevices ( Date . now ( ) ) // Some time after the threshold
483+ const { mockCasparCg, deviceToken } = await createMockPlayoutGatewayAndDevices ( Date . now ( ) ) // Some time after the threshold
477484
478485 ; ( logger . info as jest . Mock ) . mockClear ( )
479486 // set time to 2020/07/{date} 04:05 Local Time, should be more than 24 hours after 2020/07/19 00:00 UTC
@@ -496,7 +503,7 @@ describe('cronjobs', () => {
496503 Meteor . callAsync (
497504 'peripheralDevice.functionReply' ,
498505 cmd . deviceId , // deviceId
499- '' , // deviceToken
506+ deviceToken , // deviceToken
500507 cmd . _id , // commandId
501508 null , // err
502509 null // result
0 commit comments