【发布时间】:2017-08-02 14:26:24
【问题描述】:
我需要验证服务成功和错误状态后的响应。我的服务如下。
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');
});
};
我需要验证索引、supportingDocuments 变量。 我创建了一个模拟如下。
DocumentServiceMock = jasmine.createSpyObj('DocumentService', [
'deleteDocument'
]);
我该怎么做?
【问题讨论】: