Skip to content

Commit

Permalink
chore: fix windows test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsup committed Mar 7, 2024
1 parent 25ca59e commit 8e47434
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1366,9 +1366,13 @@ describe('read()', () => {
it('handles requests that close early', async (flags) => {

let readPromise;
let readError;
const handler = (req, res) => {

readPromise = Wreck.read(req);
readPromise = Wreck.read(req).catch((err) => {

readError = err;
});
promise.req.abort();
};

Expand All @@ -1389,8 +1393,9 @@ describe('read()', () => {
const server = await internals.server(handler);
const promise = Wreck.request('post', `http://localhost:${server.address().port}`, { payload, headers });
await expect(promise).to.reject();
const err = await expect(readPromise).to.reject(Error, 'Payload stream closed prematurely');
expect(err.isBoom).to.equal(true);
await readPromise;
expect(readError).to.be.an.error('Payload stream closed prematurely');
expect(readError.isBoom).to.equal(true);
});

it('errors on partial payload transfers', async (flags) => {
Expand Down

0 comments on commit 8e47434

Please sign in to comment.