rollbar 2.25.0 → 2.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -226,9 +226,10 @@ describe('addRequestInfo', function() {
226
226
  it('should use window info to set request properties', function(done) {
227
227
  var args = ['a message'];
228
228
  var item = itemFromArgs(args);
229
- var options = {};
229
+ var options = { captureIp: 'anonymize' };
230
230
  t.addRequestInfo(window)(item, options, function(e, i) {
231
231
  expect(i.data.request).to.be.ok();
232
+ expect(i.data.request.user_ip).to.eql('$remote_ip_anonymize');
232
233
  done(e);
233
234
  });
234
235
  });
@@ -243,6 +244,19 @@ describe('addRequestInfo', function() {
243
244
  done(e);
244
245
  });
245
246
  });
247
+ it('should honor captureIp without window', function(done) {
248
+ var args = ['a message'];
249
+ var item = itemFromArgs(args);
250
+ item.data = {};
251
+ var options = { captureIp: true };
252
+ var w = null;
253
+ t.addRequestInfo(w)(item, options, function(e, i) {
254
+ expect(i.data.request.url).to.not.be.ok();
255
+ expect(i.data.request.query_string).to.not.be.ok();
256
+ expect(i.data.request.user_ip).to.eql('$remote_ip');
257
+ done(e);
258
+ });
259
+ });
246
260
  });
247
261
 
248
262
  describe('addClientInfo', function() {
@@ -422,11 +422,13 @@ describe('callback options', function() {
422
422
 
423
423
  rollbar.log('test'); // generate a payload to inspect
424
424
 
425
- expect(window.fetchStub.called).to.be.ok();
426
- var body = JSON.parse(window.fetchStub.getCall(0).args[1].body);
427
- expect(body.data.foo).to.eql('bar');
425
+ setTimeout(function() {
426
+ expect(window.fetchStub.called).to.be.ok();
427
+ var body = JSON.parse(window.fetchStub.getCall(0).args[1].body);
428
+ expect(body.data.foo).to.eql('bar');
428
429
 
429
- done();
430
+ done();
431
+ }, 1);
430
432
  });
431
433
 
432
434
  it('should use transform when set', function(done) {
@@ -442,11 +444,13 @@ describe('callback options', function() {
442
444
 
443
445
  rollbar.log('test'); // generate a payload to inspect
444
446
 
445
- expect(window.fetchStub.called).to.be.ok();
446
- var body = JSON.parse(window.fetchStub.getCall(0).args[1].body);
447
- expect(body.data.foo).to.eql('baz');
447
+ setTimeout(function() {
448
+ expect(window.fetchStub.called).to.be.ok();
449
+ var body = JSON.parse(window.fetchStub.getCall(0).args[1].body);
450
+ expect(body.data.foo).to.eql('baz');
448
451
 
449
- done();
452
+ done();
453
+ }, 1);
450
454
  });
451
455
  });
452
456