1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing tests

This commit is contained in:
Patrik Braun 2017-07-19 08:00:51 +02:00
parent 663f4edc39
commit e56efae1ac

View File

@ -4,6 +4,8 @@ import {UserDTO} from "../../../../common/entities/UserDTO";
import "rxjs/Rx"; import "rxjs/Rx";
import {LoginCredential} from "../../../../common/entities/LoginCredential"; import {LoginCredential} from "../../../../common/entities/LoginCredential";
import {AuthenticationService} from "./authentication.service"; import {AuthenticationService} from "./authentication.service";
import {NetworkService} from "./network.service";
import {ErrorDTO} from "../../../../common/entities/Error";
class MockUserService { class MockUserService {
public login(credential: LoginCredential): Promise<UserDTO> { public login(credential: LoginCredential): Promise<UserDTO> {
@ -15,12 +17,19 @@ class MockUserService {
} }
} }
class MockNetworkService {
addGlobalErrorHandler(fn: (error: ErrorDTO) => boolean) {
}
}
describe('AuthenticationService', () => { describe('AuthenticationService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{provide: NetworkService, useClass: MockNetworkService},
{provide: UserService, useClass: MockUserService}, {provide: UserService, useClass: MockUserService},
AuthenticationService] AuthenticationService,
]
}); });
}); });