@@ -18,15 +18,15 @@ function test(name: string, config: Test) {
1818 it ( 'single chunk' , ( ) => {
1919 const setup = setupTest ( config ) ;
2020 setup . decoder . write ( config . toWrite ) ;
21- assertCalls ( config , setup ) ;
21+ assertSpiesCalls ( config , setup ) ;
2222 } ) ;
2323
2424 it ( 'byte by byte' , ( ) => {
2525 const setup = setupTest ( config ) ;
2626 for ( let i = 0 ; i < config . toWrite . length ; i ++ ) {
2727 setup . decoder . write ( config . toWrite . subarray ( i , i + 1 ) ) ;
2828 }
29- assertCalls ( config , setup ) ;
29+ assertSpiesCalls ( config , setup ) ;
3030 } ) ;
3131 } )
3232}
@@ -49,7 +49,7 @@ function setupTest(config: Test) {
4949 } ;
5050}
5151
52- function assertCalls ( config : Test , spies : ReturnType < typeof setupTest > ) {
52+ function assertSpiesCalls ( config : Test , spies : ReturnType < typeof setupTest > ) {
5353 assertSpyCalls ( spies . onReplySpy , config . replies ) ;
5454 assertSpyCalls ( spies . onErrorReplySpy , config . errorReplies ) ;
5555 assertSpyCalls ( spies . onPushSpy , config . pushReplies ) ;
@@ -302,6 +302,40 @@ describe('RESP Decoder', () => {
302302 replies : [ [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ]
303303 } ) ;
304304
305+ test ( 'with all types' , {
306+ toWrite : Buffer . from ( [
307+ '*13\r\n' ,
308+ '_\r\n' ,
309+ '#f\r\n' ,
310+ ':0\r\n' ,
311+ '(0\r\n' ,
312+ ',0\r\n' ,
313+ '+\r\n' ,
314+ '$0\r\n\r\n' ,
315+ '=4\r\ntxt:\r\n' ,
316+ '-\r\n' ,
317+ '!0\r\n\r\n' ,
318+ '*0\r\n' ,
319+ '~0\r\n' ,
320+ '%0\r\n'
321+ ] . join ( '' ) ) ,
322+ replies : [ [
323+ null ,
324+ false ,
325+ 0 ,
326+ 0n ,
327+ 0 ,
328+ '' ,
329+ '' ,
330+ '' ,
331+ new SimpleError ( '' ) ,
332+ new BlobError ( '' ) ,
333+ [ ] ,
334+ [ ] ,
335+ Object . create ( null )
336+ ] ]
337+ } ) ;
338+
305339 test ( 'null (RESP2 backwards compatibility)' , {
306340 toWrite : Buffer . from ( '*-1\r\n' ) ,
307341 replies : [ null ]
0 commit comments