How to Mock JSON with $httpBackend in Jasmine
There is a lot of information out there on running tests for Angular using Jasmine + Karma. One thing that was tripping me up, though, was being able to access a mock JSON file, rather than trying to hit a server with an HTTP request every test. Working from this code sample, I injected the mock file with the beforeEach call. However, I wasn’t able to access the JSON response until I injected the defaultJSON directly into the specific test: ...