-
Notifications
You must be signed in to change notification settings - Fork 4
/
qunit-istanbul.js
42 lines (37 loc) · 1.05 KB
/
qunit-istanbul.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var order = require('ordenado');
var QUnit = require('qunitjs'); // require QUnit and all its friends
require('qunit-tap')(QUnit, console.log); // tell qunit-tap to use console.log for test output
var actual = [];
var expected = [ 'one', 'two', 'three' ];
function callback(err, first, second){
console.log(err, first, second);
}
order([
function(callback){
actual.push('one');
callback(null, 'one', 'two');
},
function(arg1, arg2, callback){
actual.push('two');
callback(null, 'three');
},
function(arg1, callback){
// arg1 now equals 'three'
actual.push('three');
callback(null, 'done');
}
], function (err, result) {
// result now equals 'done'
check();
callback(err, result);
});
var check = function(){
// write a few tests
QUnit.test("results appear in the order we expect them", function() {
for(i=0; i<actual.length; i++){
equal(actual[i],expected[i], ''+i + ' is ' + actual[i] +' | expected: '+ expected[i]);
}
});
// console.log(actual);
};
QUnit.load(); // run our test suite.