mercredi 16 août 2017

How to test TypeScript abstract class with Jasmine

I have a very simple abstract class which I implement in my Angular service. I am trying to write some tests for it but cannot find any information about testing abstract classes in the Jasmine docs.

import { Page } from '../models/index';

import { Observable } from 'rxjs/Observable';

export abstract class ILayoutGeneratorService {
  abstract generateTemplate(page: Page, deviceType: string ): Observable<string>;
}

I am wondering how I would write a basic isolated unit test that checks if the class above can be implemented and its single method called. I understand that I would somehow have to mock the implementation of the class, but I am not really sure how to go about this.

Aucun commentaire:

Enregistrer un commentaire