vendredi 27 février 2015

Javascript Mocha Tests - Testing function expressions inside function expressions


I haven't used Mocha before, so I am a real novice when it comes to testing. However, I wanted to know if it's possible to test a function expression inside of a function expression? I know there are other posts on how you cannot access function expressions inside function declarations and so on.


So, is it possible to access function expressions inside function expressions and test with Mocha? For example, I have the following code:



var masterFunction = function() {

var siGogglin = functionDeclaration(putSomethingHere);

function functionDeclaration(code) {
var yoyo = [];

//some stuff I don't want you to see

return yoyo;
};
};


Is it possible to test the function functionDeclaration from the variable siGogglin within masterFunction? If so, could you give me an example of how it could be done?


Thanks.





Aucun commentaire:

Enregistrer un commentaire