Created
March 14, 2017 09:30
-
-
Save Undistraction/f3388438d41c0f449316abb625b4c932 to your computer and use it in GitHub Desktop.
jest mock
This file contains 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
let data; | |
let errorMessage; | |
const analyseImageWithVibrant = jest.fn( | |
() => new Promise((resolve, reject) => { | |
if (data) { | |
resolve(data); | |
} else { | |
reject(errorMessage); | |
} | |
}), | |
); | |
export default analyseImageWithVibrant; | |
// eslint-disable-next-line no-underscore-dangle | |
export const __setData = (d, message) => { | |
data = d; | |
errorMessage = message; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment