Im writing integration test of a service in nodejs application using mocha and sinonjs. I want test a service, but, the function of this service that i will test, internally this function calls another function that integrate with an external application and return some values that will be use for the firts function. I want mock the return values of second method because my test are focused in functionality about the first function.
How can i do that ?
I was able to mock the value, but only if in my test I directly call the function, but is not my case.
Im using this sintaxe:
stub = sinon.stub(object, 'function')
but, the function in that case, will be called internally by a first function that i will test
Thanks
Aucun commentaire:
Enregistrer un commentaire