vendredi 19 juin 2020

How to solve "Invalid provider for the NgModule 'DynamicTestModule" in Angular 9?

I am working in angular project and i try to run test cases for signin component and I am getting this error from auth.service.ts when I run test cases it shows Invalid provider for the NgModule 'DynamicTestModule' - only instances of Provider and Type are allowed, got: [..., ..., ..., ?undefined?, ...] error

Here is my signin.component.spec.ts:

public login(usercreds: any, record: boolean): Observable<boolean> {
        let url: string = environment.apiEndpoint + '/token';
        let body: any = { 'email': usercreds.email, 'password': usercreds.password };
        let headers: HttpHeaders = new HttpHeaders().set('Content-Type', 'application/json');

        return this.http.post<ITokenMsg>(url, body, { headers: headers })
            .pipe(
                map((value: ITokenMsg): boolean => { return this.handleAuthResponse(value.token, record); }),
                catchError((err: any) => { return this.handleAuthError(err); }),
        );
    }

Aucun commentaire:

Enregistrer un commentaire