vendredi 4 décembre 2015

Mocking in Qunit

How do we mock a method in Qunit. I have a situation where I need to mock some methods and return some value. For example I have a function which internally calls the getBrowser() function. I want to mock the get browser and pretend as if it is returning a value of "Chrome". Also is there a way of mocking the objects or variables.For example, is there a way of mocking navigator.userAgent? Thanks in anticipation.

Aucun commentaire:

Enregistrer un commentaire