mercredi 4 avril 2018

Unit test in angular for flatMap and Map

I have one issue, I can not test the following code.

getActions (): Observable<any> {
    return this.configService.getMessage('url_actions_contestation')
       .flatMap((url: string) => this.hubConn.get(url))
        .map((resp) => resp.json());
}

Calling the getAction function, just test the first line, and I tried to use spyOn for mocky the return value, but is not working. He don't test this.hubConn.get() and resp.json() code this.hubConn.get() is like Http!

getActions (): Observable<any> {
    return this.configService.getMessage('url_actions_contestation') 

Can anyone help me?

Thanks a lot! Sorry for my knowledge and english!

Aucun commentaire:

Enregistrer un commentaire