From the course: Angular Essential Training

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Unit testing without dependency injection

Unit testing without dependency injection - Angular Tutorial

From the course: Angular Essential Training

Unit testing without dependency injection

- [Instructor] Earlier in this course, we looked at what unit testing is and how you would run an existing suite of unit tests in your project. In this video, we'll keep things simple and look at one common pattern for unit testing angular pipes. I opened our project here in a GitHub code space. I talk about why we use code spaces earlier in this course, so for now, just think of them as an easy way to share and write code without installing anything on your local machine. I'll go to the source folder, open the app folder, pipes, join, and click on join.pipe.spec.ts to open the file. Always use the spec.ts ending for your unit tests. The Angular CLI tool does this for you when you generate new files using the NG generate command. This file has all the unit tests for our custom join pipe. Pipes are pure stateless functions by default. This means they always return the same output for a given set of inputs. This makes…

Contents