Skip to content

Commit

Permalink
test: replace typeof undefined check (fastify#272)
Browse files Browse the repository at this point in the history
* test: replace `typeof` undefined check

* simplify

---------

Co-authored-by: Aras Abbasi <[email protected]>
  • Loading branch information
Fdawgs and Uzlopak authored Oct 29, 2023
1 parent 619e125 commit ba185e8
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions test/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,7 @@ test('Should be able to pass custom connectionOptions to createWebSocketStream',
})

fastify.get('/', { websocket: true }, (connection) => {
// readableObjectMode was added in Node v12.3.0 so for earlier versions
// we check the encapsulated readable state directly
const mode = (typeof connection.readableObjectMode === 'undefined')
? connection._readableState.objectMode
: connection.readableObjectMode
t.equal(mode, true)
t.equal(connection.readableObjectMode, true)
connection.socket.binaryType = 'arraybuffer'

connection.once('data', (chunk) => {
Expand Down

0 comments on commit ba185e8

Please sign in to comment.