Some portion of code is still using the old success handler which is currently making it difficult to test the lines inside them.
Below is my sample function:
function updateXYZExemption(partyId, payload) {
if (!partyId) {
throw new Error('partyId is required');
}
return $.ajax({
dataType: 'json',
contentType: 'application/json',
type: 'PUT',
data: JSON.stringify(payload),
url: config.urls.updateXYZExemptionUrl.replace(/\{partyId\}/, partyId),
headers: {
'If-Match': eTag
},
success: function (data, textStatus, request) {
if (request.getResponseHeader('ETag')) {
eTag = request.getResponseHeader('ETag');
}
}
});
}
I am able to test that this function returns a promise but the function which is assigned to success property is not reachable.