Skip to content

Commit

Permalink
chore: fix socket test
Browse files Browse the repository at this point in the history
Depending on timing either error can be thrown.
  • Loading branch information
achingbrain committed Oct 9, 2024
1 parent d4da569 commit 7509e5b
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')
}

Check warning on line 489 in packages/transport-tcp/test/socket-to-conn.spec.ts

View check run for this annotation

Codecov / codecov/patch

packages/transport-tcp/test/socket-to-conn.spec.ts#L488-L489

Added lines #L488 - L489 were not covered by tests

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

Expand Down

0 comments on commit 7509e5b

Please sign in to comment.