Since we introduced a new userService, create a fake implementation for it, using the same pattern from authService and commonTestingProviders with it.
- Implement IUserService interface for UserService
src/app/user/user/user.service.ts
export interface IUserService {
currentUser: BehaviorSubject<IUser>
getCurrentUser(): Observable<IUser>
getUser(id): Observable<IUser>
updateUser(user: IUser): Observable<IUser>
getUsers(pageSize: number, searchText: string, pagesToSkip: number): Observable<IUsers>
}
...
export class UserService extends CacheService implements IUserService {
- Implement the fake user service
src/app/user/user/user.service.fake.ts
import { Injectable } from '@angular/core'
import { BehaviorSubject, Observable, of } from 'rxjs'
import { IUser, User } from './user'
import { IUsers, IUserService...