mercredi 4 mai 2016

Mocking/Stubbing globals in sails.js

In Sails.js we've created a wrapper around logging functionality so that security audit logs have the same format and information etc.

I'd like to unit test the wrapper that in turn calls sails.log.info. How can I mock/stub the global sails.log.info and then verify that it was called? I've used proxyquire and rewire before but they were in the context of stubbing out modules that were required into the files.

Aucun commentaire:

Enregistrer un commentaire