The purpose of this PR is to refactor BufferReader to be testable.
Description
I've split the logic that was contained in the private readSubqueue method into a number of "private" (in the JS sense) methods that are exposed to the test runner:
shouldLoadQueue: bool
shouldReadQueue: bool
readEnvelopeIntoBuffers
The public interface is still the same. One could imagine an interface definition as follows:
Goal
The purpose of this PR is to refactor
BufferReader
to be testable.Description
I've split the logic that was contained in the private
readSubqueue
method into a number of "private" (in the JS sense) methods that are exposed to the test runner:shouldLoadQueue: bool
shouldReadQueue: bool
readEnvelopeIntoBuffers
The public interface is still the same. One could imagine an interface definition as follows:
Maybe we can define this in a subsequent PR.
Notes
This PR solves a bug involving multiple callbacks that occurs on Node version 16+.