Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for tag support on node-asana-api
- Loading branch information
Tom Ridge
committed
Nov 30, 2012
1 parent
9d420d5
commit d90558a
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* tags-test.js: Tests for the tag resources of the Asana API. | ||
* | ||
* (C) 2012 Charlie Robbins | ||
* | ||
*/ | ||
|
||
var vows = require('vows'), | ||
assert = require('./assert'), | ||
helpers = require('./helpers'); | ||
|
||
var config = helpers.loadConfig(); | ||
|
||
vows.describe('asana-api/tags').addBatch({ | ||
"When using an instance of asana.Client": { | ||
topic: helpers.createClient(), | ||
"the tags.list() method": { | ||
topic: function (client) { | ||
client.tags.list(this.callback); | ||
}, | ||
"should respond with a list of tags": function (err, tags) { | ||
assert.isNull(err); | ||
assert.isArray(tags); | ||
assert.hasNameAndId(tags); | ||
} | ||
}, | ||
"the tags.get() method": { | ||
topic: function (client) { | ||
if (config.tags && config.tags[0]) | ||
client.tags.get(config.tags[0], this.callback); | ||
else | ||
this.callback("no tag configured on config.json"); | ||
}, | ||
"should respond with a valid tag": function (err, tag) { | ||
assert.isNull(err); | ||
assert.isTag(tag); | ||
} | ||
}, | ||
"the tags.tasks() method": { | ||
topic: function (client) { | ||
if (config.tags && config.tags[0]) | ||
client.tags.tasks(config.tags[0], this.callback); | ||
else | ||
this.callback("no tags configured in config.json"); | ||
}, | ||
"should respond with valid tasks": function (err, tasks) { | ||
assert.isNull(err); | ||
assert.isArray(tasks); | ||
assert.hasNameAndId(tasks); | ||
} | ||
}, | ||
"the tags.create() method": { | ||
topic: function(client) { | ||
client.tags.create(config.workspaces[0], { | ||
name: 'testing tag' | ||
}, this.callback); | ||
}, | ||
"should respond with a valid tag": function(err, tag) { | ||
assert.isNull(err); | ||
assert.isTag(tag); | ||
} | ||
}, | ||
"the tags.update() method": { | ||
topic: function(client) { | ||
if (config.tags && config.tags[0]) | ||
client.tags.update(config.tags[0],{name: 'testing tag2'}, this.callback); | ||
else | ||
this.callback("no tags configured in config.json"); | ||
}, | ||
"should respond with a valid tag": function(err, tag) { | ||
assert.isNull(err); | ||
assert.deepEqual('testing tag2', tag.name); | ||
assert.isTag(tag); | ||
} | ||
} | ||
} | ||
}).export(module); |