Skip to content

Commit

Permalink
test: 💍 add new test for empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Jul 9, 2024
1 parent 0cc34fd commit 2a9a127
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/basics/test/url-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,31 @@ describe('URLConnect', () => {
done(new Error('Error is the right behavior'));
});
});
test('#4ter', (done) => {
ezs.use(statements);
const input = ['1a', '2a', '3a', '4a', '5a'];
from(input)
.pipe(ezs('URLConnect', {
url: 'http://127.0.0.1:33331/empty.ini',
json: true,
retries: 1,
}))
.pipe(ezs.catch())
.on('error', (e) => {
try {
expect(e.message).toEqual(expect.stringContaining("URL returned an empty response "));
done();
} catch(ee) {
done(ee);
}
})
.on('data', () => {
done(new Error('Error is the right behavior'));
})
.on('end', () => {
done(new Error('Error is the right behavior'));
});
});
}
test('#5', (done) => {
ezs.use(statements);
Expand Down

0 comments on commit 2a9a127

Please sign in to comment.