Test failing when checking response body for array
I found a potential issue within v1.6.4 when checking that a response body resolves to an array.
I have the following jest test which is failing:
it(`GET todos`, async () => {
return request(app.getHttpServer())
.get('/todos')
.set('Authorization', `Bearer ${accessToken}`)
.expect(200)
.expect(await todoService.findAll());
});
Note that await todoService.findAll() returns an array.
This test produces the following error:
expected one of "[object Object]", got 200 "OK"
Reverting the supertest package version back to v1.6.3 fixes the issue and the test passes as expected.
Potentially related change: https://github.com/visionmedia/supertest/commit/ab252f372c13128bcd1d8562d8ea395ef46d02c1
see https://github.com/visionmedia/supertest/pull/728#issuecomment-896998201
Thanks @niftylettuce I can confirm that this is now fixed within v1.6.5