I have been working with node and using vows to write tests.
var vows = require('vows');
var assert = require('assert');
var boardData = require('../lib/data/BoardData.js');
vows.describe('Loading provinces and Boundries for').addBatch({
'version': {
'2008E5-1':{
topic: function () { boardData.createBoard("2008E5",this.callback); },
'exists': function (err,provs,bounds) { assert.ok(true); }
}/*,
'2008E5-2': {
topic: function () { boardData.createBoard("2008E5",this.callback); },
'exists': function (err,provs,bounds) { assert.ok(true); }
}*/
}
}).export(module);
When I Run this code I get the expected results. When I uncomment the commented section notice that two completed successfully but one can discover that is the second one twice by placing a console.log("foo"); in the proper location.
·· ✓ OK » 2 honored (0.067s)
·
✗ Errored » callback not fired
in version 2008E5-1
in Loading provinces and Boundries for
in undefined
This must be that I am missing something or lack the understanding of something, but I cannot figure it out. Can anyone help me? Thanks in advance!
It concerns me that the "version" key doesn't have a topic. I think it needs a topic of its own. You can nest sub-topics under it if you need to.
Or, run it with the --spec
option to see exactly what tests are being run.
vows --spec
or
./node_modules/vows/bin/vows --spec