lundi 30 janvier 2017

What should we test with unit test of Angular2 Component

I am newbie to Angular2. I wrote a small application in Angular2 which has few components. I want to write unit tests for my client application.

Someone suggested me when we write unit test for a component (written in AngularJS) then it loads the template/html as well for that component. We have to take care of UI elements inside the unit test.

My point is we should only be writing the unit test for 1. The (typescript) methods defined inside the component which has some logic or processing 2. Any service code written in the application.

We should not be bothered about the actual UI elements (html/CSS). Testing framework should not be loading the UI template (HTML/CSS) at all.

Is my understanding about unit test is correct. Please give your inputs.

Atul Sureka

Aucun commentaire:

Enregistrer un commentaire