fix deprecated functions. add unit tests with jasmine