mercredi 2 mars 2016

Angular2+Jasmine: how to unit test for protected member in a class?

I had a parent class and a child class(actually a component class) extends from super class, consider of the protect of data, I defined all the member as protected. When doing unit test, I was told that I can't access protected member. How should I test it?

describe("child class", () => {

    let child: Child;

    beforeEach(() => {
        child = new Child();
    });

    describe("Initialization", () => {
        expect(child.member).toBe(...);
    });

});

Aucun commentaire:

Enregistrer un commentaire