Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created June 21, 2011 23:32
Show Gist options
  • Save indexzero/1039224 to your computer and use it in GitHub Desktop.
Save indexzero/1039224 to your computer and use it in GitHub Desktop.
A quick tutorial of sequential async testing in vows
var vows = require('vows'),
assert = require('assert'),
fs = require('fs');
var first;
vows.describe('some/file/testing').addBatch({
"First we want to read a file": {
topic: function () {
first = true;
fs.readFile('path/to/first/file', this.callback);
},
"should return the data in path/to/first/file": function (err, data) {
assert.isTrue(!err);
assert.isNotNull(data);
},
"Then when we want to read a second file": {
topic: function () {
fs.readFile('path/to/second/file', this.callback);
},
"should return the data in path/to/second/file": function (err, data) {
assert.isTrue(!err);
assert.isNotNull(data);
assert.isTrue(first);
}
}
}
}).export(module);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment