Created
June 21, 2011 23:32
-
-
Save indexzero/1039224 to your computer and use it in GitHub Desktop.
A quick tutorial of sequential async testing in vows
This file contains hidden or 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
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