-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsv-test.js
More file actions
36 lines (32 loc) · 901 Bytes
/
Copy pathcsv-test.js
File metadata and controls
36 lines (32 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require("../env");
var vows = require("vows"),
assert = require("assert");
var suite = vows.describe("d3.csv");
suite.addBatch({
"csv": {
topic: function() {
var cb = this.callback;
return d3.csv("examples/data/sample.csv", function(csv) {
cb(null, csv);
});
},
"invokes the callback with the parsed CSV": function(csv) {
assert.deepEqual(csv, [{"Hello":42,"World":"\"fish\""}]);
},
"overrides the mime type to text/csv": function(csv) {
assert.equal(XMLHttpRequest._last._info.mimeType, "text/csv");
},
"": {
topic: function() {
var cb = this.callback;
return d3.csv("//does/not/exist.csv", function(csv) {
cb(null, csv);
});
},
"invokes the callback with null when an error occurs": function(csv) {
assert.isNull(csv);
}
}
}
});
suite.export(module);