@@ -104,7 +104,7 @@ describe('APNS', () => {
104104
105105 var prodApnsConnection = apns . providers [ 0 ] ;
106106 expect ( prodApnsConnection . index ) . toBe ( 0 ) ;
107-
107+
108108 // TODO: Remove this checking onec we inject APNS
109109 var prodApnsOptions = prodApnsConnection . client . config ;
110110 expect ( prodApnsOptions . cert ) . toBe ( args [ 1 ] . cert ) ;
@@ -239,7 +239,7 @@ describe('APNS', () => {
239239 expect ( notification . pushType ) . toEqual ( 'alert' ) ;
240240 done ( ) ;
241241 } ) ;
242-
242+
243243 it ( 'can generate APNS notification from raw data' , ( done ) => {
244244 //Mock request data
245245 let data = {
@@ -259,17 +259,17 @@ describe('APNS', () => {
259259 let collapseId = "collapseIdentifier" ;
260260 let pushType = "background" ;
261261 let priority = 5 ;
262-
262+
263263 let notification = APNS . _generateNotification ( data , { expirationTime : expirationTime , collapseId : collapseId , pushType : pushType , priority : priority } ) ;
264-
264+
265265 expect ( notification . expiry ) . toEqual ( Math . round ( expirationTime / 1000 ) ) ;
266266 expect ( notification . collapseId ) . toEqual ( collapseId ) ;
267267 expect ( notification . pushType ) . toEqual ( pushType ) ;
268268 expect ( notification . priority ) . toEqual ( priority ) ;
269-
269+
270270 let stringifiedJSON = notification . compile ( ) ;
271271 let jsonObject = JSON . parse ( stringifiedJSON ) ;
272-
272+
273273 expect ( jsonObject . aps . alert ) . toEqual ( { "loc-key" : "GAME_PLAY_REQUEST_FORMAT" , "loc-args" : [ "Jenna" , "Frank" ] } ) ;
274274 expect ( jsonObject . aps . badge ) . toEqual ( 100 ) ;
275275 expect ( jsonObject . aps . sound ) . toEqual ( 'test' ) ;
@@ -315,6 +315,20 @@ describe('APNS', () => {
315315 done ( ) ;
316316 } ) ;
317317
318+ it ( 'does log on invalid APNS notification' , async ( ) => {
319+ const args = {
320+ cert : new Buffer ( 'testCert' ) ,
321+ key : new Buffer ( 'testKey' ) ,
322+ production : true ,
323+ topic : 'topic'
324+ } ;
325+ const log = require ( 'npmlog' ) ;
326+ const spy = spyOn ( log , 'warn' ) ;
327+ const apns = new APNS ( args ) ;
328+ apns . send ( ) ;
329+ expect ( spy ) . toHaveBeenCalled ( ) ;
330+ } ) ;
331+
318332 it ( 'can send APNS notification' , ( done ) => {
319333 let args = {
320334 cert : new Buffer ( 'testCert' ) ,
0 commit comments