jeudi 30 juillet 2015

Unit test $httpBackend with query params

Using $httpBackend, how can I use expectGET with a url that has query params? The order doesn't matter, and the value doesn't matter.

$httpBackend
  .expectGET('/api/my_endpoint/example?X=false&Y=someethingelse&Z=anotherthing')
  .respond(200, {});

Using $resource this is how I declare it:

  get: {
      method: 'GET',
      url: '/api/my_endpoint/example',
      params: {
        X: '@X',
        Y: '@Y',
        Z: '@Z',
      }
    }

Aucun commentaire:

Enregistrer un commentaire