Skip to content

Commit

Permalink
Revert "Update test to handle EPIPE in test"
Browse files Browse the repository at this point in the history
This reverts commit c8cb72d.
  • Loading branch information
ijjk committed Jan 27, 2020
1 parent 56f6ec5 commit efd2abe
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions test/integration/api-support/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,16 @@ function runTests(dev = false) {
})

it('should return error exceeded body limit', async () => {
let res
let error

try {
res = await fetchViaHTTP(appPort, '/api/parse', null, {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8',
},
body: JSON.stringify(json),
})
} catch (err) {
error = err
}
const data = await fetchViaHTTP(appPort, '/api/parse', null, {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8',
},
body: JSON.stringify(json),
})

if (error) {
// This is a temporary workaround for testing since node doesn't handle
// closed connections when POSTing data to an endpoint correctly
// https://github.com/nodejs/node/issues/12339
expect(error.code).toBe('EPIPE')
} else {
expect(res.status).toEqual(413)
expect(res.statusText).toEqual('Body exceeded 1mb limit')
}
expect(data.status).toEqual(413)
expect(data.statusText).toEqual('Body exceeded 1mb limit')
})

it('should parse bigger body then 1mb', async () => {
Expand Down

0 comments on commit efd2abe

Please sign in to comment.