working karma-test after refactoring