Skip to content

Commit

Permalink
chore: fix socket test (#2756)
Browse files Browse the repository at this point in the history
Depending on timing either error can be thrown.
  • Loading branch information
achingbrain authored Oct 9, 2024
1 parent ab51119 commit e99e8f4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/transport-tcp/test/socket-to-conn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,16 @@ describe('socket-to-conn', () => {
expect(serverTimedOut.promise).to.eventually.be.true(),

// server socket was closed for reading and writing
expect(serverClosed.promise).to.eventually.be.true(),

// client connection was closed abruptly
expect(clientError.promise).to.eventually.have.property('code', 'ECONNRESET')
expect(serverClosed.promise).to.eventually.be.true()
])

const err = await clientError.promise

// can be either error depending on platform and timing
if (err.code !== 'ECONNRESET' && err.code !== 'EPIPE') {
expect.fail('client connection did not close abruptly')
}

// server socket should no longer be writable
expect(serverSocket.writable).to.be.false()

Expand Down

0 comments on commit e99e8f4

Please sign in to comment.