Open ernieay opened 7 years ago
I got the same issue.
I got it. It was the issue with my test cases. AWS.restore
needs to be called once the promise resolves, not before that of course.
@ngocketit You sir, are a genius.
and I am a fool.
I shall close this issue.
@ngocketit thank you very much for remembering to come back and share what you did to make it work! That's really helpful to everyone else using promises
in their code. ✅
@ernieay you're no "fool". (don't be so hard on yourself!) 😸
Yay! now... if we could update the Readme (Docs) with a Promises section this would be a great outcome! 😉
I have a promise chain that calls two different aws functions sequentially:
In my tests I mock them as such:
However, the second function is not mocked - the code calls the real AWS function and I never reach the commented section of my code. The tests/mocks previously worked when the code was written using just callbacks, but has stopped once we refactored to use promises.
Am I using aws-sdk-mock incorrectly, or is this a limitation of the package?