forked from lmatteis/node-trello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.js
37 lines (33 loc) · 1 KB
/
tests.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
var assert = require('assert'),
Trello = require('./main.js');
var key = process.argv[2];
var token = process.argv[3];
var org = process.argv[4];
var t = new Trello(key, token);
// https://trello.com/docs/api/index.html
var tests = {
testParams: function(){
var args = { foo: "bar", "french":"noob"};
var query = t.params(args);
var expected = "foo=bar&french=noob";
assert.equal(query, expected, query + " should be " + expected);
},
getBoards: function() {
t.get("/1/organization/"+org+"/boards/all", function(err, data) {
if(err) throw err;
assert.ok(data.length > 0);
});
},
getBoardsWithArgs: function() {
var args = { fields: "name,desc" };
t.get("/1/organization/"+org+"/boards/all", args, function(err, data) {
if(err) throw err;
assert.ok(data.length > 0);
// we asked for two fields, but id is always returned, so we look for 3
assert.equal(3, Object.keys(data[0]).length)
});
}
};
for(var i in tests) {
tests[i]();
}