mercredi 20 juillet 2016

How can I test this Angular 2 service?

I have the following service in my Angular application:

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

@Injectable()
export class BookService {

  constructor(private http: Http) {}

  getList() {
    return this.http.get('/api/books.json');
  }
}

How would I test the getList() function?

I don't need every last detail, just some general direction. I assume this is pretty well-worn territory but I'm having trouble finding documentation on how people normally go about testing something like this. Once I know the direction to go, I can probably chase down the details myself.

Aucun commentaire:

Enregistrer un commentaire