Angular 2 Services Testing Template

Here’s a simple template for testing Angular 2 services. If the HttpModule portions are uncommented and used, it will make actual wire calls. To use mock calls instead, see Angular 2 MockBackend Service Testing Template Using TestBed instead. import { async, inject, TestBed } from '@angular/core/testing'; // import { HttpModule... [Read More]
Tags: angular, testing

Angular 2 MockBackend Service Testing Template Using TestBed

Below is a template for using TestBed and MockBackend for mocking Angular 2 HTTP calls. If you want to make actual wire calls, see Angular 2 Services Testing Template instead. import { async, inject, TestBed } from '@angular/core/testing'; import { BaseRequestOptions, Http, HttpModule, Response, ResponseOptions } from '@angular/http'; import {... [Read More]
Tags: angular, testing