Skip to content

test(http): structure tests better#182

Merged
kettanaito merged 1 commit intomainfrom
test/client-request
Nov 11, 2021
Merged

test(http): structure tests better#182
kettanaito merged 1 commit intomainfrom
test/client-request

Conversation

@kettanaito
Copy link
Copy Markdown
Member

@kettanaito kettanaito commented Nov 10, 2021

@kettanaito kettanaito force-pushed the test/client-request branch 2 times, most recently from f2eeac7 to 50efa1d Compare November 11, 2021 12:49
@kettanaito kettanaito marked this pull request as ready for review November 11, 2021 12:50
* using the "mock" response source.
*/
static suppressErrorCodes = ['ENOTFOUND', 'ECONNREFUSED']
static suppressErrorCodes = ['ENOTFOUND', 'ECONNREFUSED', 'ECONNRESET']
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding ECONNRESET to the list of suppressed socket errors.

private responseSource: 'mock' | 'bypass' = 'mock'
private capturedError?: NodeJS.ErrnoException

public requestBody: Buffer[] = []
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making requestBody public so it can be directly asserted in tests.

)
// Write the last request body chunk to the internal request body buffer.
if (chunk) {
this.requestBody = concatChunkToBuffer(chunk, this.requestBody)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concatenating the last chunk provided to .end() so it becomes a part of the this.requestBody.

@kettanaito kettanaito merged commit 3c10639 into main Nov 11, 2021
@kettanaito kettanaito deleted the test/client-request branch November 11, 2021 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClientRequest: test actual connections Add tests for NodeClientRequest's "setEncoding" on the mocked response

1 participant