guyja
guyja

Reputation: 917

jasmine test a Restangular response

I'm calling

Restangular.all('resource').getList() 

and I want to test that the results are as expected.

In my test, I want to make this work

expectedResp = { one: 1, two: 2, three: 3 };
expect(resp).toEqual(expectedResp);

The problem is that the resp from restangular is restangularized, meaning it contains a bunch of members in addition to the data returned from the rest call.

Upvotes: 2

Views: 193

Answers (1)

Estus Flask
Estus Flask

Reputation: 223164

It should be

expectedResp = { one: 1, two: 2, three: 3 };
expect(resp).toEqual(jasmine.objectContaining(expectedResp));

Upvotes: 2

Related Questions