Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Flowing state test compat for v0.10 (pre-streams3)
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisJEllis committed Feb 24, 2017
1 parent fa3aa07 commit d94ebf4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/raven.client.js
Expand Up @@ -958,6 +958,9 @@ describe('raven.Client', function () {
});

describe('http breadcrumbs', function () {
// prior to streams3 _readableState.flowing started as false, now starts as null
var initialFlowingState = process.version < 'v0.12' ? false : null;

beforeEach(function () {
client = new raven.Client(dsn, { autoBreadcrumbs: { http: true } });
client.install();
Expand All @@ -972,11 +975,11 @@ describe('raven.Client', function () {
client.context(function () {
var http = require('http');
http.get(url.parse(testUrl), function (response) {
response._readableState.should.have.property('flowing', null);
response._readableState.should.have.property('flowing', initialFlowingState);
// need to wait a tick here because nock will make this callback fire
// before our req.emit monkeypatch captures the breadcrumb :/
setTimeout(function () {
response._readableState.should.have.property('flowing', null);
response._readableState.should.have.property('flowing', initialFlowingState);
client.getContext().breadcrumbs[0].data.url.should.equal(testUrl);
client.getContext().breadcrumbs[0].data.status_code.should.equal(200);
scope.done();
Expand All @@ -995,11 +998,11 @@ describe('raven.Client', function () {
client.context(function () {
var https = require('https');
https.get(url.parse(testUrl), function (response) {
response._readableState.should.have.property('flowing', null);
response._readableState.should.have.property('flowing', initialFlowingState);
// need to wait a tick here because nock will make this callback fire
// before our req.emit monkeypatch captures the breadcrumb :/
setTimeout(function () {
response._readableState.should.have.property('flowing', null);
response._readableState.should.have.property('flowing', initialFlowingState);
client.getContext().breadcrumbs[0].data.url.should.equal(testUrl);
client.getContext().breadcrumbs[0].data.status_code.should.equal(200);
scope.done();
Expand Down

0 comments on commit d94ebf4

Please sign in to comment.