dimanche 28 décembre 2014

Jasmine have createSpy() return mock object

I'm trying to mock up a response object, and it looks something like this:



var res = {
status: jasmine.createSpy().andReturn(this),
send: jasmine.createSpy().andReturn(this)
}


This returns the jasmine object. I'd really like to return the original res variable containing the mocked functions. Is that possible? I'm mainly implementing this to unit test functions contains res.status().send(), which is proving to be difficult.


Aucun commentaire:

Enregistrer un commentaire