DavidTanner / nodecredstash

MIT License
43 stars 22 forks source link

Mocking this package using sinon stub #28

Closed mehroosali closed 4 years ago

mehroosali commented 4 years ago

How do i stub the methods of this package using sinon stub?

i have tried doing, let Credstash = require('nodecredstash') let credstashStub = sinon.stub(Credstash.prototype, 'getSecret')

but gives me error 'TypeError: Cannot stub non-existent own property getSecret'. any help would be appreciated?

mehroosali commented 4 years ago

used proxyquire for mocking. solved the issue.