How to print log during karma Testing

Viewed 7428

I am a beginner for Angular, recently I started working on Angular. I have written some unit testing code, as follows.

it('fetch data should be correct',
inject(
  [HttpTestingController, Service2Service],
  (
    httpMock: HttpTestingController,
    dataService: Service2Service
  ) =>{
        dataService.getData().subscribe((event: HttpEvent<any>) => {
          console.info("HttpEventType.Response",HttpEventType.Response);
          switch (event.type) {
            case HttpEventType.Response:{
              console.log("body",event.body);
              expect(event.body.length).toEqual(110);
            }
          }
        });
      }
  )

);

I am trying to print using console.log but it not printing on console. Kindly suggest another way to print log.

Thanks in advance.

1 Answers
Related