I'm beginning start writing some Mocha tests for an application I've been working on.
When running onn of the tests fails I'm getting the following error:
(node:12988) UnhandledPromiseRejectionWarning: AssertionError: Failure reason: expected 'Fail' to include 'Success'
Whilst I understand the failure reason, I'm really struggling to resolve the UnhandledPromiseRejection warning and have gone round in circles with the issue.
Any ideas?
describe('Test', function() {
it('This should complete succesfully', function() {
class Obj {
getResult() {
return new Promise(function(resolve, reject) {
resolve('Fail');
});
}
}
var obj = new Obj();
obj.getResult().then(function(res) {
expect(res).to.include('Success');
});
});
});