It should also be noted that AngularJS and Node.js are more heavily favored by developers. Spring and Django seem to gaining popularity with employers and developers alike but not quite as much as React. Visit HackerRank for the full breakdown.
Until recently, the front-end testing I’d done had not directly tested any Angular services. In almost every case, the $http calls in the services were just returning data from an API back to a controller. However, on a recent project I had a scenario where the data from the API had to have some filtering and permission logic applied before passing on the data. This was a case where unit testing the service made sense.
As it turns out, testing a service is very similar to testing a controller in terms of setting up the test, injecting dependencies, and making assertions. The only real difference is the need to mock the $http call in the service. To do this the angular-mocks library provides the $httpBackend tool. Let’s walk through an example of testing a service.
Over the past few months I have been working with Angular a lot. I had no previous knowledge of Angular before this. The Pluralsight course that helped me out the most was AngularJS: Get Started by Scott Allen. It was very easy to follow along. Scott was very good at explaining what he was doing.
One other resource that I found was very helpful was a walkthrough on scotchio. This was good to go through after watching the training video. This walkthrough actually showed how to set up a simple project. It didn’t have as much explanation involved but it was a good walkthrough of exactly how to get a sample project set up and was a good starting point for creating a project to play around with.