I'm completely new to node.js testing, maybe you can help me out: I want to do some more or less simple tests for my express webapp using vows and tobi (for example testing if the login route works)
var vows = require('vows');
var assert = require('assert');
var tobi = require('tobi');
var browser = tobi.createBrowser(8080, 'localhost');
vows.describe('mytest').addBatch({
'GET /': {
topic: function() {
browser.get("/", this.callback);
},
'has the right title': function(res, $) {
$('title').should.equal('MyTitle');
}
}
}).export(module);
and I get this:
♢ mytest
GET /
✗ has the right title
» expected { '0':
{ _ownerDocument:
[....lots of stuff, won't paste it all.....]
Entity: [Function: Entity],
EntityReference: [Function: EntityReference] } },
selector: ' title' } to equal 'MyTitle' // should.js:295
✗ Broken » 1 broken (0.126s)
I can't recognize what's wrong from this output but I'm guessing it has someone to do with callbacks. I'm also fairly new to the async style of programming in node.js.