-
Notifications
You must be signed in to change notification settings - Fork 781
Description
Hello,
First, thank you for this module that I've been using for a while now.
I've recently run into a problem when updating module to 3.1.0.
A test I have is no longer working and throws me : Error: write EPIPE.
This is the following test :
it('uploads a file but 400 during validation', () => app.server
.post(`${baseUrl}/files`)
.set('Authorization', token)
.attach('file', `${fixturesPath}/files.jpg`)
.expect(400)
.then((res) => {
expect(res.body).have.property('success').and.equal(false);
expect(res.body).have.property('error').and.to.be.an('object');
expect(res.body.error).have.property('fileType').and.equal('is required');
}));
The function I try to test here, just throws an error which should validate the expect(400) and expects in the then.
The expected error is sent and printed in the terminal :
BadRequest { status: 400, message: { fileType: 'is required' } }
[0mPOST /api/v1/prospect/files [33m400[0m6.224 ms - 51[0m
But right after the end of the request I get the Error: write EPIPE., before entering the validation part of the test.
I've try logging something in the then but the error happens before that but after request is completed.
it('uploads a file but 400 during validation', () => app.server
.post(`${baseUrl}/files`)
.set('Authorization', token)
.attach('file', `${fixturesPath}/files.jpg`)
.expect(400)
.then((res) => {
console.log('something'); // <-- This code is never reached
expect(res.body).have.property('success').and.equal(false);
expect(res.body).have.property('error').and.to.be.an('object');
expect(res.body.error).have.property('fileType').and.equal('is required');
}));
Is this an issue with the way I write the test ? (I have 630 other tests working fine, with similar syntax).
This test is still working fine with 3.0.0 and only breaks in 3.1.0, I'm therefore unable to update the module since I don't know how to make this test work.
Would you need any more info on how we could fix this ?
Thank you,