Testing angular component - having a hard look at it

A typical unit test for Angular looks like this :-

We need to understand

a) A component or fixture represent our angular component which might include a single or more markups.

b) DebugElement are basically specific html markup like span or div that we would like to find after it is our component rendered.

So, in our test it is important to know what we've already initialized our component using code below :-

Next we get an instance of our component and check if it contains certain markups as shown below :-


Popular posts from this blog

Solving Sonarqube :- Project was never analyzed. A regular analysis is required before a branch analysis

spark - pyspark reading from excel files