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: ...

Aug 8, 2014 · Christopher Boette

Aw, CRUD.

Day 11 at MakerSquare. Started the day with a motivational/direction-giving/advise-giving talk from a graduate of cohort #2, who two weeks out from graduating, has accepted an offer at a local company, which is sort of a big deal. The main bit of advice for us was that we should code, code, and code. And then code some more. Front-end: Javascript objects look like hashes but they’re not; they’re objects. We saw something like this structure later in the day, which was a great way to reinforce it. ...

Nov 26, 2013 · Christopher Boette