var baseUrl = 'http://localhost:3481';
before each test I adding handler for that GET
request
$httpBackend.when('GET', new RegExp(baseUrl + '/reports\\?.*', 'g'))
in one of it
expression, I'm expecting the following request
var startTime = moment().subtract(1, 'week'),
endTime = moment(),
queryParams = "endTime=" + endTime.toISOString() +
"&startTime=" + startTime.toISOString();
$httpBackend.expectGET(baseUrl + '/reports?' + queryParams);
But I continue to get
Error: Unsatisfied requests [GET] http://localhost:3481/reports?endTime...
I have tried regexp with that string and reg.test()
method returns true
http://grab.by/NFHi
tried also with that
'http://localhost:3481/reports?endTime=2016-01-27T20:41:52.302Z&startTime=2016-01-26T20:41:52.302Z'.match(new RegExp('http://localhost:3481' + '/reports\\?.*', 'g'))
and it returns
["http://localhost:3481/reports?end..."]
What is the problem here?