@@ -21,13 +21,20 @@ describe('itemToPayload', function() {
2121 var args = [ 'a message' , { custom : 'stuff' } ] ;
2222 var item = itemFromArgs ( args ) ;
2323 item . accessToken = 'abc123' ;
24+ item . _isUncaught = true ;
25+ item . _originalArgs = [ 'c' , 3 ] ;
26+ item . data = { } ;
2427 var options = {
2528 endpoint : 'api.rollbar.com' ,
2629 payload : { body : 'hey' , x : 42 }
2730 } ;
2831 t . itemToPayload ( item , options , function ( e , i ) {
32+ expect ( i . _isUncaught ) . to . eql ( item . _isUncaught ) ;
33+ expect ( i . _originalArgs ) . to . eql ( item . _originalArgs ) ;
34+
35+ // This transform shouldn't apply any payload keys.
2936 expect ( i . body ) . to . not . eql ( 'hey' ) ;
30- expect ( i . x ) . to . eql ( 42 ) ;
37+ expect ( i . x ) . to . not . eql ( 42 ) ;
3138 done ( e ) ;
3239 } ) ;
3340 } ) ;
@@ -46,6 +53,23 @@ describe('itemToPayload', function() {
4653 } ) ;
4754} ) ;
4855
56+ describe ( 'addPayloadOptions' , function ( ) {
57+ it ( 'ignores options.payload.body but merges in other payload options' , function ( done ) {
58+ var args = [ 'a message' , { custom : 'stuff' } ] ;
59+ var item = itemFromArgs ( args ) ;
60+ item . accessToken = 'abc123' ;
61+ var options = {
62+ endpoint : 'api.rollbar.com' ,
63+ payload : { body : 'hey' , x : 42 }
64+ } ;
65+ t . addPayloadOptions ( item , options , function ( e , i ) {
66+ expect ( i . data . body ) . to . not . eql ( 'hey' ) ;
67+ expect ( i . data . x ) . to . eql ( 42 ) ;
68+ done ( e ) ;
69+ } ) ;
70+ } ) ;
71+ } ) ;
72+
4973describe ( 'addTelemetryData' , function ( ) {
5074 it ( 'adds the data to the right place if events exist' , function ( done ) {
5175 var item = {
0 commit comments