Task/add unit tests

#### Reviewers
@jframos @flopezag @jesuspg 

#### Description
ADD unit tests

#### Test
tested locally 
Yes, sure it has been done in this way for years, but it the first time that I see it.

Yes refactor it.