mercredi 24 décembre 2014

Testing yeoman's composeWith

I'm trying to test generator compose scenario. In my generator I call a sub-generator if a certain prompt returns true



if(this.bar){
this.composeWidth('foo:bar', {});
}


I obviously test the bar sub-generator separately. However I would like to have an assert for this composeWith() to have been called. And I guess the problem is rather in my skills than yeoman testing docs but I have no idea how to do this. I understand that I need a spy and a stub. But the docs just list the functions and the tests for yeoman-generator itself are just mental (I tried reproducing their steps, but they mostly use dummies for everything and I only need to stub out the sub-generator).


Any help would be really appreciated. Thank you.


Aucun commentaire:

Enregistrer un commentaire