- Resources PRO
- Lesson 1: Introduction PRO
- Lesson 2: Introduction to Test Driven Development PRO
- Lesson 3: Testing Concepts PRO
- Lesson 4: Jasmine, Karma, and Protractor PRO
- Lesson 5: A Simple Unit Test PRO
- Lesson 6: A Simple E2E Test PRO
- Lesson 7: Introduction to Angular's TestBed PRO
- Lesson 8: Setting up Tests PRO
- Lesson 9: Test Development Cycle PRO
- Lesson 10: Getting Ready PRO
- Lesson 11: The First Tests PRO
- Lesson 12: Injected Dependencies & Spying on Function Calls PRO
- Lesson 13: Building out Core Functionality PRO
- Lesson 14: Testing Asynchronous Code PRO
- Lesson 15: Creating a Mock Backend PRO
- Lesson 16: Setting up the Server PRO
- Lesson 17: Testing Integration with a Server PRO
- Lesson 18: Testing Storage and Reauthentication PRO
- Lesson 19: Refactoring with Confidence PRO
- Lesson 20: Conclusion PRO
With the theory of the last two lessons out of the way, we now have all the knowledge we need to finish off the rest of the tests for our application. Now we are going to focus on one of the more complex requirements that we had for the application.
- A user should only be able to log in to the application with a valid license key from SendOwl
In order to implement this requirement, we will need to create a unit test for a service that handles checking a license key against a server - which isn't a problem because we know how to create a mocked backend now. As we know, a unit test by itself is not enough though - we will also need to implement an E2E test for this functionality. When running our E2E test we will not be mocking the backend, we will be hitting the real server.
Of course, that means we need a server to handle the request! The purpose of this module is not to get into details about how to create a a backend server for an application, so we are going to keep this as simple as possible. We are going to create a simple server with Node and Express that will just return us a "passing" response for any request we make to it.
The specific integration with SendOwl is not really important. However, if you are interested in how that integration works I will be leaving the code for that in the server setup - it will just be commented out. If you want to actually set up the integration with SendOwl you would need to create your own SendOwl account and set up a product that you want to sell.