Fixing Jasmine tests. Refactoring tests.