I have a method written in javascript and I am using Jasmine to test the method.
The method is a void type which is invoking another method .
I have to test if the method is invoking the other method, the present method is returning void.
what should I write in the expect clause to compare it.
sendMessage=function(data){
if(data!=null)
{
postMessage(data);
}
}
Jasmine code :
describe('unit test void method', function(){
it("sendMessage method should invoke the postMessage", function () {
expect(sendMessage("hello");
})
})
what should I compare it with ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…