Skip to content

Instantly share code, notes, and snippets.

@rconnelly
Created August 13, 2012 00:13
Show Gist options
  • Save rconnelly/3335637 to your computer and use it in GitHub Desktop.
Save rconnelly/3335637 to your computer and use it in GitHub Desktop.
var vows = require('vows'),
assert = require('assert');
// Create a Test Suite
vows.describe('Divide and Multiply').addBatch({
'when multiplying 2 by 2': { // Context (batch 1)
topic: function () { return 2 * 2; },
'we get four': function (topic) { // Vow w/Topic arg
assert.equal (topic, 4); // Async
}
},
'but when dividing two by two': { // Context (batch 2)
topic: function () { return 2 / 2 },
'we get one': { // Sub-Context
'is not a number': function (topic) {
assert.equal(topic, 1)
},
'is not equal to four': function (topic) {
assert.notEqual (topic, 4);
}
}
}
}).export(module); // use with testrunner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment