I'm writing test cases. While some of the testcases are easy to write as they output either numbers or objects, some of them place HTML on the page. For example, if I have this function:
var placeDivs = function(data){
for(var i = 0; i < data.length; i++){
$('body').append(data[i]);
}
}
Data could look like this:
var data = ['foo', 'bar', 'example'];
Data should not be allowed to have numbers (ignoring that the function allows them). The expected output is the text being appended to the body element. What would be the correct way to write a test case for this function?
Aucun commentaire:
Enregistrer un commentaire