Setting up the Server
Creating the real server for the application
PROModule Outline
- Source Code & Resources PRO
- Lesson 1: Introduction PUBLIC
- Lesson 2: Introduction to Test Driven Development PUBLIC
- Lesson 3: Testing Concepts PUBLIC
- Lesson 4: Jest and Cypress 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 with Jest and Cypress PUBLIC
- Lesson 9: Test Development Cycle PRO
- Lesson 10: Setting up Cypress & Jest in an Ionic/Angular Project 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
Lesson Outline
Setting up the Server
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 - 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. Definitely do not use this as an example of how to create a modern NodeJS server - we won't be using any modern tooling at all, it is literally just going to be a plain JavaScript file.
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.
Thanks for checking out the preview of this lesson!
You do not have the appropriate membership to view the full lesson. If you would like full access to this module you can view membership options (or log in if you are already have an appropriate membership).