Added unit tests.

Based on karma & jasmine.