masson
Version:
Module execution engine for cluster deployments.
72 lines (67 loc) • 1.32 kB
JavaScript
var masson = require('masson'),
assert = require('assert');
/*
aaa
/
aa \
/ aab
a - ab - aba
\
ac - aca - acaa
*/
exports['test nested dependencies'] = function(){
var assertions = [];
var m = masson({
'a': function(){
this.in(['aa','ab','ac'],function(){
this.out();
});
},
'aa': function(){
this.in(['aaa','aab'],function(){
this.out();
});
},
'aaa': function(){
this.out();
},
'aab': function(){
this.out();
},
'ab': function(){
this.in('aba',function(){
this.out();
});
},
'aba': function(){
this.out();
},
'ac': function(){
this.in(['aca'],function(){
this.out();
});
},
'aca': function(){
this.in('acaa',function(){
this.out();
});
},
'acaa': function(){
this.out();
},
'target 2': function(){
}
},'a');
m.on('before',function(context){
assertions.push('before '+context.target);
})
m.on('after',function(context){
assertions.push('after '+context.target);
})
process.nextTick(function(){
assert.deepEqual(
['before a','before aa','before aaa','after aaa','before aab','after aab','after aa','before ab','before aba','after aba','after ab','before ac','before aca','before acaa','after acaa','after aca','after ac','after a'],
assertions
);
});
};