public getTxFilterData(): any {
this.txRejectsService.showLoader = true;
var momentObj: moment.MomentStatic = moment;
this.$http({
url: txRejectsReadApi,
method: "GET",
params: {
startDate: momentObj(this.selectedStartDate).format("MM/DD/YYYY"),
endDate: momentObj(this.selectedEndDate).format("MM/DD/YYYY"),
sourceSystem: this.selectedSourceSystem.Name || '',
eventType: this.selectedEventType.Id || ''
}
}).then((response) => {
var localTxData = this.convertUTCDateTimeToLocal(response.data);
this.populateGridData(localTxData);
this.txRowSelected = false;
this.txRejectsService.showLoader = false;
}, (error) => {
this.notificationService.error({
message: "Failed to load data. Try again."
});
this.txRejectsService.showLoader = false;
this.$log.error(`error ${error}`);
this.$log.info(error);
})
}
我想专门测试函数内部$ http的.then()块和error()块。我是使用Jasmine进行单元测试的新手,为任何错误道歉。