1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-16 11:37:13 +02:00
pigallery2/frontend/app/model/autehentication.service.spec.ts

38 lines
902 B
TypeScript
Raw Normal View History

///<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();
}));
});