1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/model/autehentication.service.spec.ts
2016-03-19 09:58:27 +01:00

38 lines
902 B
TypeScript

///<reference path="../../browser.d.ts"/>
import {
it,
inject,
injectAsync,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {Component, provide} from 'angular2/core';
import {AuthenticationService} from "../../../frontend/app/model/authentication.service";
import {UserService} from "./user.service";
describe('LoginService', () => {
beforeEachProviders(() => [
provide(UserService, {
useFactory: function() {
return {login() {}};
}
}),
AuthenticationService
]);
it('should call User service login', inject([ AuthenticationService,UserService ], (authService, userService) => {
spyOn(userService,"login");
expect(userService.login).not.toHaveBeenCalled();
authService.login();
expect(userService.login).toHaveBeenCalled();
}));
});