UI Deploy

Curated, Short, Web UI Dev we Love.

How to verify JSON data with AngularJS $httpBackend

When we are writing Unit Test for AngularJS Controller or Service, it’s pretty common to verify the data posted to server using $httpBackend in ngMock module.

Consider the most common method: expect(method, url, data, headers), from the doc, we find that the data is expected to be either String or RegExp.

view source

Advertisement