File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,6 +178,31 @@ describe('UNIT Sender', function () {
178178 } , 10 ) ;
179179 } ) ;
180180
181+ it ( 'should ignore properties of body that are unknown or invalid types' , function ( done ) {
182+ var mess = {
183+ delay_while_idle : "a string" ,
184+ collapse_key : true ,
185+ time_to_live : 100 ,
186+ dry_run : true ,
187+ data : {
188+ name : 'Matt'
189+ } ,
190+ unknown_property : "hello"
191+ } ;
192+ var sender = new Sender ( 'mykey' ) ;
193+ sender . sendNoRetry ( mess , '' , function ( ) { } ) ;
194+ setTimeout ( function ( ) {
195+ var body = args . options . json ;
196+ expect ( body . delay_while_idle ) . to . equal ( undefined ) ;
197+ expect ( body . collapse_key ) . to . equal ( undefined ) ;
198+ expect ( body . time_to_live ) . to . equal ( mess . time_to_live ) ;
199+ expect ( body . dry_run ) . to . equal ( mess . dry_run ) ;
200+ expect ( body . data ) . to . deep . equal ( mess . data ) ;
201+ expect ( body . unknown_property ) . to . equal ( undefined ) ;
202+ done ( ) ;
203+ } , 10 ) ;
204+ } ) ;
205+
181206 it ( 'should set the registration_ids to reg tokens implicitly passed in' , function ( done ) {
182207 var sender = new Sender ( 'myKey' ) ;
183208 var m = { data : { } } ;
You can’t perform that action at this time.
0 commit comments