Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should return details from response', () => {
const error = new ApiError('status', 500, {details: 'details'});
expect(getErrorDetails({payload: error})).to.equal('details');
});
it('should return message from response of ApiError if no response errorMessage', () => {
const error = new ApiError('status', 500);
expect(getErrorMessage({
payload: error
})).to.eql({
errorMessage: error.message
});
});
it('should return errorMessage from response of ApiError if present', () => {
expect(getErrorMessage({
payload: new ApiError('status', 500, {
errorMessage: 'apiError'
})
})).to.eql({
errorMessage: 'apiError'
});
});