Skip to content

Commit

Permalink
🤖 TEST: Big stream timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jul 5, 2022
1 parent 6b5a4f1 commit a8876f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/options.stream.test.ts
Expand Up @@ -62,11 +62,12 @@ describe('options.stream.test.ts', () => {
// console.error(err);
assert.equal(err.name, 'HttpClientRequestTimeoutError');
assert.equal(err.message, 'Request timeout for 100 ms');
assert.equal(err.cause.name, 'HeadersTimeoutError');
// stream should be close after request error fire
assert.equal(stream.destroyed, true);
return true;
}),
pEvent(stream, 'close'),
pEvent(stream, 'error'),
]);
// stream close
assert.equal(stream.destroyed, true);
Expand All @@ -79,13 +80,12 @@ describe('options.stream.test.ts', () => {
streamError = true;
});
await assert.rejects(async () => {
await urllib.request(_url, {
await urllib.request(`${_url}block`, {
method: 'post',
timeout: 100,
stream,
});
}, (err: any) => {
console.error(err);
// console.error(err);
assert.equal(err.name, 'Error');
assert.match(err.message, /no such file or directory/);
assert.equal(stream.destroyed, true);
Expand Down
2 changes: 0 additions & 2 deletions test/options.writeStream.test.ts
Expand Up @@ -75,12 +75,10 @@ describe('options.writeStream.test.ts', () => {
let writeStreamError = false;
writeStream.on('error', () => {
writeStreamError = true;
// console.log('writeStreamError');
});
await assert.rejects(async () => {
await urllib.request(_url, {
writeStream,
timeout: 100,
});
}, (err: any) => {
// console.error(err);
Expand Down

0 comments on commit a8876f2

Please sign in to comment.