I need to validate the response after success and error states of a service. My service as belows.
vm.onSupportFileDeleted = function (file) {
DocumentService.deleteDocument(file.fileId).then(function () {
var index = vm.supportingDocuments.indexOf(file);
vm.supportingDocuments.splice(index, 1);
vm.dzRemoveFile(file);
setSupportFileStatusA11yAlert('Document removed');
//advanced-options-link
angular.element('#advanced-options-link').trigger('focus');
}, function (msg) {
$log.error('Document not deleted - ' + JSON.stringify(msg));
showSupportingDocumentError('Unable to delete file');
setSupportFileStatusA11yAlert('Unable to remove document');
});
};
I need to validate index, supportingDocuments variables. I have created a mock as below.
DocumentServiceMock = jasmine.createSpyObj('DocumentService', [
'deleteDocument'
]);
How can i do this?