Created
December 4, 2018 12:40
-
-
Save balintsera/237f166f971b85cadd9478a0469e1516 to your computer and use it in GitHub Desktop.
Mock a single method of a class with Rewire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rewired = rewire('../index.js') | |
const orig = require('../service/SESMail') | |
orig.prototype.send = () => { return Promise.resolve() } | |
rewired.__set__({ | |
'SESMail': orig | |
}) | |
expect(rewired.handler.bind(null, testEvent, null)).to.not.throw() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment