mercredi 27 janvier 2016

$httpBacked, Error: Unsatisfied requests for regexed when statement

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

What is the problem here?

Aucun commentaire:

Enregistrer un commentaire