We require a fast way to test the REST API. We will create a server with fake data.
- [Instructor] Welcome to video 4.2.…Creating a REST API Node JS Server with Fake Data.…In the previous video, we talked about…how to create and test the service…that uses the NG resource module…and how to use mocks to test it.…In this video, we'll be talking about…how to remove the need for mocks…by creating a REST API server…that serves fake data using Node JS.…To make sure that integration…between your friend and AngularJS app…and that backend REST API services…you use go smoothly,…we need to make a server that has fake data.…
This will make it possible for us to use…Protractor for running End2End tests.…When we right unit tests, we use mocks…to keep the test self contained.…In the unit tests, we don't make any requests…to any REST API server.…When we write End2End tests,…we want to make sure that everything…if functioning end to end.…We are writing a server that serves fake data…because we don't have a real REST API server back end.…In the real world, you will typically…have a back end REST API server running…
AngularJS offers the perfect balance between layout and code, making the framework a favorite of developers around the world. But what you might not know is that Angular also provides an outstanding infrastructure for testing, for developing bug-free and easily maintainable applications. Learning AngularJS Testing helps you to understand the different aspects involved in testing Angular components, including controllers and directives, with the help of a practical pizza-ordering application.
Author Rudolf Olah starts by installing and initializing various helpful testing tools, such as Karma, Jasmine, and Grunt. Then he creates controllers for ordering the pizza and reviewing the order, and tests them with and without dependencies. Chapter 3 shows how to create accordion directives for the application, unit test them, and resolve the errors if these tests fail. Rudolf also goes through testing of the navigation between two controllers with the help of End2End testing. Finally, learn how to modify services to use the $resource module and interact with REST API web services, as well as unit test them with the help of mocks and spies. Rudolf also shows how to create and test directives and controllers that fetch information from the service and display it.
- Configuring Angular, Grunt, Karma, and Jasmine for testing
- Testing controllers
- Testing directives
- Inspecting the navigation between components with End2End testing
- Creating REST API services and unit testing them to make your app compelling and user friendly