I'm running a test using mocha
it('should allow a POST to /users', async function () {
const res = await request.post('/users').send(firstUserBody);
expect(res.status).to.equal(201);
expect(res.body).not.to.be.empty;
expect(res.body).to.be.an('object');
expect(res.body.id).to.be.a('string');
firstUserIdTest = res.body.id;
});
but i have an error
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
If I do it using done() the function is not async but it should be
it('should allow a POST to /users', async function (done) {
const res = await request.post('/users').send(firstUserBody);
expect(res.status).to.equal(201);
expect(res.body).not.to.be.empty;
expect(res.body).to.be.an('object');
expect(res.body.id).to.be.a('string');
firstUserIdTest = res.body.id;
done();
});
what should i do ?