Suddenly tests fail on my d3 library

17 views
Skip to first unread message

Ben Hunter

unread,
Feb 27, 2015, 9:44:45 AM2/27/15
to jasmi...@googlegroups.com
I am new to testing things. Two weeks ago I finally got a bunch of jasmine tests working on a d3 library I've been writing. Tried vows, didn't like it for some reason, got jasmine working and loved it. I know I used v2.1 and d3 3.5. My library certainly has potential for some problems, but all my examples pass a visual inspection.

I took about 12 days off from the package, according to my github repo, to do some other stuff, and when I came back, nothing passes. D3 cannot select anything in the DOM. Each of my tests fail as soon as d3 tries to select the body and append a div. 

the actual tests are here: https://github.com/benjh33/ggd3

var d3 = require('d3'),
    _ = require('lodash'),
// my library and a module with datasets
    ggd3 = require('../dist/ggd3.v.0.1.0.js'),
    data = require('../data/data.js');

describe("make chart", function() {
  var chart = // create chart object,
       id = "someid";
  div = d3.select('body').append('div')
                  .attr('id', id);
  beforeAll(function(done) {
    chart.draw(div);
    setTimeout(function() {
      done();
    }, 1000);
  })
  afterAll(function() {
    d3.select('#' + id).remove();
  })
  it("has 90 rectangles", function() {
    // count selects id and counts the number of elements with selector
    count(id, 'rect', 90);
  });
});

Thanks,
Ben

Ben Hunter

unread,
Feb 27, 2015, 2:30:46 PM2/27/15
to jasmi...@googlegroups.com
Nevermind. Reverted back to d3 3.5.3 and things are working again.
Reply all
Reply to author
Forward
0 new messages