I am unit testing a get request that has two querystring params, I can't for the life of me figure out how to write the expect get correctly
describe('CostEffectivenessService#getCostEffectivenessChartData', function() {
it('should request correct url', function() {
expect(api.GET_COST_EFFECTIVENESS_CHART_DATA).toBe('CostEffectiveness/GetCostEffectivenessChartData');
});
it('should get cost effectiveess chart data', function() {
$httpBackend.expectGET(/CostEffectiveness\/GetCostEffectivenessChartData\?effectiveTime=*\&fiscalYear=2014/)
.respond([{}, {}, {}, {}]);
var promise = costEffectivenessService.getCostEffectivenessChartData(2014),
results = null;
promise.then(function(res) {
results = res;
});
$httpBackend.flush();
expect(results.lengths).toBe(4);
});
results in this error
Error: Unexpected request: GET CostEffectiveness/GetCostEffectivenessChartData?effectiveTime=2015-05-01T15:33:11.590Z&fiscalYear=2014 Expected GET /CostEffectiveness/GetCostEffectivenessChartData\?effectiveTime=*\&fiscalYear=2014/
can any body help me out please!!!
Aucun commentaire:
Enregistrer un commentaire