0

I get this error with firstValueFrom when using NestJS + Axios HttpService.

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

await firstValueFrom(this.httpService.get(url, { headers }));

But at the same time, jest completes successfully and my requests do not hang. What is the right thing to do in this situation?

Don't suggest --forceExit :)

UPD #1:

public async getData() {
    const url = 'correct url here :) ';
    const headers = {};
    return await firstValueFrom(this.httpService.get(url, { headers }));
}

Test:

describe('Service', () => {
    describe('Main', () => {
        it('get data', async () => {
            const result = await service.getData();
            expect(result.data).toBeDefined();
        });
    });
});
Melixion
  • 457
  • 1
  • 5
  • 17

0 Answers0