lundi 28 mars 2016

Create extended anonymous class for Abstract class in TypeScript

I have abstract class which has few implemented protected methods and few abstract methods. I am trying to write some tests for the protected methods.

Since these are not available even in the extended classes to outside world, I would like to create anonymous Test class which can extend and verify/mock my stuff.

export abstract class AbsClass implements AbsInterface {

    protected extract(filter: string) {
    //some implemented code to test
    }

    abstract someMethod();
}

I am not able to figure out how to create something like this anonymously

export class TestClass extends AbsClass {
   public testExtract(){
        //call super.extract and verify result
   }
}

Aucun commentaire:

Enregistrer un commentaire