Repository navigation
test(eio-parser): assert the decoded payload in the binary stream tests - #5586
Merged
darrachequesne merged 1 commit intoNov 5, 2026
Merged
Conversation
Three assertions in the packet decoder stream tests had no matcher, so the
comparison was evaluated and discarded:
expect(areArraysEqual(value.data, payload));
Those tests checked the packet type and that the data was an ArrayBuffer, but
never that the decoded bytes matched what was written, which is what the test
names describe. The five other `areArraysEqual` assertions in these files, one
of them added in socketio#5583, already use `.to.be(true)`.
Member
|
Good catch, thanks 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The kind of change this PR does introduce
Current behavior
Three assertions in
packages/engine.io-parser/test/index.tshave no matcher, so the comparison isevaluated and thrown away:
They are in
should decode a binary packet (ArrayBuffer)at the small, medium and big sizes. Each ofthose tests checks the packet type and that the data is an
ArrayBuffer, but nothing checks that thedecoded bytes match what was written, which is what the test names describe.
decodePacketcouldreturn a buffer of the right length and wrong contents and all three would still pass.
The five other
areArraysEqualassertions in these files already use.to.be(true), including theone added in #5583.
New behavior
The three assertions use
.to.be(true), matching their neighbours.Other information (e.g. related issues)
npm run test:nodeinpackages/engine.io-parser: 33 passing before and after, so the payloads doround-trip correctly today. Replacing the three new matchers with
.to.be(false)gives 30 passingand 3 failing, so they do assert.
npm run format:checkreports no changes.