- 
                Notifications
    You must be signed in to change notification settings 
- Fork 603
Phase 3.2: WebSocketConnection Comprehensive Testing #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Changes from 1 commit
ec44126
              444552e
              b476c63
              66b1c55
              f1bfa74
              8e8e59c
              10f10f3
              ad83d44
              1d61b10
              2d79d06
              f7d0706
              cb9ec1f
              504bfc9
              3a3fb52
              de16a07
              27fb512
              3c5ce04
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -268,7 +268,7 @@ | |
|  | ||
| write(data, encoding, callback) { | ||
| if (this.destroyed) { | ||
| throw new Error('Socket is destroyed'); | ||
| Check failure on line 271 in test/helpers/mocks.mjs 
     | ||
| } | ||
| this.writtenData.push(data); | ||
| if (callback) setTimeout(callback, 1); | ||
|  | @@ -294,11 +294,11 @@ | |
| } | ||
|  | ||
| pause() { | ||
| // Mock implementation | ||
| this.emit('pause'); | ||
| } | ||
|  | ||
| resume() { | ||
| // Mock implementation | ||
| this.emit('resume'); | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| } | ||
|  | ||
| setTimeout(timeout, callback) { | ||
|  | @@ -307,16 +307,43 @@ | |
| } | ||
| } | ||
|  | ||
| setNoDelay(noDelay) { | ||
| // Mock implementation for TCP_NODELAY | ||
| this.noDelay = noDelay; | ||
| } | ||
|  | ||
| setKeepAlive(enable, initialDelay) { | ||
| // Mock implementation for keepalive | ||
| this.keepAlive = enable; | ||
| this.keepAliveInitialDelay = initialDelay; | ||
| } | ||
|  | ||
| removeAllListeners(event) { | ||
| if (event) { | ||
| super.removeAllListeners(event); | ||
| } else { | ||
| super.removeAllListeners(); | ||
| } | ||
| } | ||
|  | ||
| on(event, listener) { | ||
| return super.on(event, listener); | ||
| } | ||
|  | ||
| simulateData(data) { | ||
| if (!this.destroyed && this.readable) { | ||
| this.emit('data', Buffer.from(data)); | ||
| this.emit('data', Buffer.isBuffer(data) ? data : Buffer.from(data)); | ||
| } | ||
| } | ||
|  | ||
| simulateError(error) { | ||
| this.emit('error', error); | ||
| } | ||
|  | ||
| simulateDrain() { | ||
| this.emit('drain'); | ||
| } | ||
|  | ||
| getWrittenData() { | ||
| return this.writtenData; | ||
| } | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to emit the
pauseevent, but consider whether you need to actually pause the socket's data flow here, or if that's handled elsewhere.