Last active
January 21, 2016 23:51
-
-
Save py-in-the-sky/d502ee71a4bfc5311f5c to your computer and use it in GitHub Desktop.
Mock a no-op promise.
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
/* | |
Needed to mock a promise for a test just so that chaining `then`s | |
and `catch`es wouldn't throw an error. The actual execution of | |
those `then`s and `catches` could be no-ops since the test wasn't | |
concerned with their functionality. | |
The mocked promise (`returnMockThenable()`) was returned from a mock | |
`fetch` call. | |
*/ | |
const returnMockThenable = () => ({ | |
then: returnMockThenable, | |
catch: returnMockThenable, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment