Simple testing patterns for Angular version 2+
TypeScript JavaScript HTML CSS
Latest commit a77caab Jan 13, 2017 @juristr committed on GitHub docs: adjust intro

Angular Testing Recipes

Build Status

This repo is for Angular version 2+. More Β»

The goal of this repository is to have a collection of recipes for common testing scenarios with Angular. I'm happy for every contribution/suggestion πŸ˜ƒ.

I've been giving a talk on "Testing with Angular".


All the scenarios are listed here below and nicely linked to the source file.

  1. Testing Components
  2. Testing Services
    • Simple stateless function
      Learn about different ways of injecting a service into a test case as well as how to test service methods.
    • Async operations
      Learn how to test async operations using the async() as well as fakeAsync() functions.
    • Mocking and remote http calls
      Learn how to mock external dependencies, such as use the MockBackend provided by Angular to respond to http calls.
  3. Custom Matchers and Utilities

Articles on Testing

Run them yourself

If you want to run the example locally,

  1. clone this repository
  2. Run npm install
  3. Run npm test to execute all the tests

By running npm run you can run the tests in watch mode which is particularly useful during development.


Wanna help? Of course! Just open an issue and/or send me a PR πŸ˜ƒ.