@@ -210,8 +210,21 @@ describe('PgPacketStream', function () {
210210 testForMessage ( md5PasswordBuffer , expectedMD5PasswordMessage )
211211 testForMessage ( SASLBuffer , expectedSASLMessage )
212212 testForMessage ( SASLContinueBuffer , expectedSASLContinueMessage )
213+
214+ // this exercises a found bug in the parser:
215+ // https://github.com/brianc/node-postgres/pull/2210#issuecomment-627626084
216+ // and adds a test which is deterministic, rather than relying on network packet chunking
217+ const extendedSASLContinueBuffer = Buffer . concat ( [ SASLContinueBuffer , Buffer . from ( [ 1 , 2 , 3 , 4 ] ) ] )
218+ testForMessage ( extendedSASLContinueBuffer , expectedSASLContinueMessage )
219+
213220 testForMessage ( SASLFinalBuffer , expectedSASLFinalMessage )
214221
222+ // this exercises a found bug in the parser:
223+ // https://github.com/brianc/node-postgres/pull/2210#issuecomment-627626084
224+ // and adds a test which is deterministic, rather than relying on network packet chunking
225+ const extendedSASLFinalBuffer = Buffer . concat ( [ SASLFinalBuffer , Buffer . from ( [ 1 , 2 , 4 , 5 ] ) ] )
226+ testForMessage ( extendedSASLFinalBuffer , expectedSASLFinalMessage )
227+
215228 testForMessage ( paramStatusBuffer , expectedParameterStatusMessage )
216229 testForMessage ( backendKeyDataBuffer , expectedBackendKeyDataMessage )
217230 testForMessage ( readyForQueryBuffer , expectedReadyForQueryMessage )
0 commit comments