forked from curran/data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
48 lines (43 loc) · 947 Bytes
/
test.js
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
37
38
39
40
41
42
43
44
45
46
47
48
var fs = require("fs");
var dsvDataset = require("dsv-dataset");
var assert = require("assert");
function load(dataSource, dataSet){
var path = dataSource + "/" + dataSet + "/" + dataSet;
return {
dsvString: fs.readFileSync(path + ".csv", "utf8"),
metadata: JSON.parse(fs.readFileSync(path + ".json", "utf8"))
};
}
describe("data", function () {
it("should parse to strings if types not specified", function() {
var dataset = load("uci_ml", "iris");
dataset = dsvDataset.parse(dataset);
assert.equal(dataset.data.length, 150);
assert.equal(typeof dataset.data[0].sepal_length, "number");
assert.equal(typeof dataset.data[0].class, "string");
});
});
//cdc
//d3Examples
//data.gov.in
//dbpedia
//dspl
//faostat
//geonames
//integrated
//iris
//jsLibraries
//migrants
//nsf
//olpc
//package.json
//pew
//senseYourCity
//statCounter
//superstoreSales
//uci_ml
//un
//usgs
//util
//w3schools
//worldFactbook