mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-16 11:37:13 +02:00
38 lines
902 B
TypeScript
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();
|
||
|
}));
|
||
|
|
||
|
|
||
|
});
|