I have a function that returns a promise. In my test file that is using chai I want the following to happen:
const result = sendSurveyDataToAnalytics(userId,eventType,eventTitle)
result.then(() => {
Logger.info("Succeed in the test if we get here")
}).catch(() => {
Logger.info("Fail in the test if we get here")
});
the code explains it. Succeed in then, fail in catch. What is the proper way to do that with maybe expect, or should (already installed chai-as-promised)
If you're using
chai-as-promised: