假设我有以下序列:
vows.describe('Example').addBatch({
'An example' : {
topic: new Example(),
'with an async method' : function(example) {
example.asyncMethod(this.callback);
},
'will do some magic' : function(err, result) {
assert.equal(result.magical, true);
},
'and then we will be back on track' : function(example) {
assert.isTrue(example.backOnTrack);
}
}
}).run();
测试“ and then we will be back on track
”是否可以与以前的主题(Example
)相匹配?
编辑
vows.describe('Example').addBatch({
'An example' : {
topic: function(example){ // <- where example is a parent topic
example.asyncMethod(this.callback);
},
'callback after an async method will do some magic' : function(err, result) {
assert.equal(result.magical, true);
},
'and then we will be back on track' : function(example) {
assert.isTrue(example.backOnTrack);
}
}
}).run();