jeudi 27 avril 2017

How to test if a class is abstract in Typescript using Mocha?

I don't even know if this makes sense as a test, but I was trying to test if some class Component was abstract in Typescript using Mocha by the only way I could think of:

expect( new Component() ).to.throw( new Error( "" ) );

however this gives me an error that makes sense but breaks the test:

Cannot create an instance of the abstract class 'Component'.

Is there any way to correctly test this?

Thank you

Aucun commentaire:

Enregistrer un commentaire