@@ -43,12 +43,12 @@ describe('SshDecoder', () => {
4343 } ) ;
4444
4545 test ( 'decodes uint32 max value' , ( ) => {
46- reader . reset ( new Uint8Array ( [ 0xFF , 0xFF , 0xFF , 0xFF ] ) ) ;
47- expect ( decoder . readUint32 ( ) ) . toBe ( 0xFFFFFFFF ) ;
46+ reader . reset ( new Uint8Array ( [ 0xff , 0xff , 0xff , 0xff ] ) ) ;
47+ expect ( decoder . readUint32 ( ) ) . toBe ( 0xffffffff ) ;
4848 } ) ;
4949
5050 test ( 'decodes uint64' , ( ) => {
51- reader . reset ( new Uint8Array ( [ 0x12 , 0x34 , 0x56 , 0x78 , 0x9A , 0xBC , 0xDE , 0xF0 ] ) ) ;
51+ reader . reset ( new Uint8Array ( [ 0x12 , 0x34 , 0x56 , 0x78 , 0x9a , 0xbc , 0xde , 0xf0 ] ) ) ;
5252 expect ( decoder . readUint64 ( ) ) . toBe ( BigInt ( '0x123456789ABCDEF0' ) ) ;
5353 } ) ;
5454
@@ -66,26 +66,46 @@ describe('SshDecoder', () => {
6666
6767 test ( 'decodes ASCII string "testing" (UTF-8)' , ( ) => {
6868 const data = new Uint8Array ( [
69- 0 , 0 , 0 , 7 , // length
70- 0x74 , 0x65 , 0x73 , 0x74 , 0x69 , 0x6e , 0x67 // "testing"
69+ 0 ,
70+ 0 ,
71+ 0 ,
72+ 7 , // length
73+ 0x74 ,
74+ 0x65 ,
75+ 0x73 ,
76+ 0x74 ,
77+ 0x69 ,
78+ 0x6e ,
79+ 0x67 , // "testing"
7180 ] ) ;
7281 reader . reset ( data ) ;
7382 expect ( decoder . readStr ( ) ) . toBe ( 'testing' ) ;
7483 } ) ;
7584
7685 test ( 'decodes ASCII string' , ( ) => {
7786 const data = new Uint8Array ( [
78- 0 , 0 , 0 , 4 , // length
79- 0x74 , 0x65 , 0x73 , 0x74 // "test"
87+ 0 ,
88+ 0 ,
89+ 0 ,
90+ 4 , // length
91+ 0x74 ,
92+ 0x65 ,
93+ 0x73 ,
94+ 0x74 , // "test"
8095 ] ) ;
8196 reader . reset ( data ) ;
8297 expect ( decoder . readAsciiStr ( ) ) . toBe ( 'test' ) ;
8398 } ) ;
8499
85100 test ( 'decodes binary string' , ( ) => {
86101 const data = new Uint8Array ( [
87- 0 , 0 , 0 , 3 , // length
88- 0x01 , 0x02 , 0x03
102+ 0 ,
103+ 0 ,
104+ 0 ,
105+ 3 , // length
106+ 0x01 ,
107+ 0x02 ,
108+ 0x03 ,
89109 ] ) ;
90110 reader . reset ( data ) ;
91111 const result = decoder . readBinStr ( ) ;
@@ -100,8 +120,13 @@ describe('SshDecoder', () => {
100120
101121 test ( 'readBin is alias for readBinStr' , ( ) => {
102122 const data = new Uint8Array ( [
103- 0 , 0 , 0 , 3 , // length
104- 0x01 , 0x02 , 0x03
123+ 0 ,
124+ 0 ,
125+ 0 ,
126+ 3 , // length
127+ 0x01 ,
128+ 0x02 ,
129+ 0x03 ,
105130 ] ) ;
106131 reader . reset ( data ) ;
107132 const result = decoder . readBin ( ) ;
@@ -119,8 +144,18 @@ describe('SshDecoder', () => {
119144
120145 test ( 'decodes mpint 0x9a378f9b2e332a7' , ( ) => {
121146 const data = new Uint8Array ( [
122- 0 , 0 , 0 , 8 , // length
123- 0x09 , 0xa3 , 0x78 , 0xf9 , 0xb2 , 0xe3 , 0x32 , 0xa7
147+ 0 ,
148+ 0 ,
149+ 0 ,
150+ 8 , // length
151+ 0x09 ,
152+ 0xa3 ,
153+ 0x78 ,
154+ 0xf9 ,
155+ 0xb2 ,
156+ 0xe3 ,
157+ 0x32 ,
158+ 0xa7 ,
124159 ] ) ;
125160 reader . reset ( data ) ;
126161 const mpint = decoder . readMpint ( ) ;
@@ -129,8 +164,12 @@ describe('SshDecoder', () => {
129164
130165 test ( 'decodes mpint 0x80' , ( ) => {
131166 const data = new Uint8Array ( [
132- 0 , 0 , 0 , 2 , // length
133- 0x00 , 0x80
167+ 0 ,
168+ 0 ,
169+ 0 ,
170+ 2 , // length
171+ 0x00 ,
172+ 0x80 ,
134173 ] ) ;
135174 reader . reset ( data ) ;
136175 const mpint = decoder . readMpint ( ) ;
@@ -139,8 +178,12 @@ describe('SshDecoder', () => {
139178
140179 test ( 'decodes mpint -1234' , ( ) => {
141180 const data = new Uint8Array ( [
142- 0 , 0 , 0 , 2 , // length
143- 0xfb , 0x2e
181+ 0 ,
182+ 0 ,
183+ 0 ,
184+ 2 , // length
185+ 0xfb ,
186+ 0x2e ,
144187 ] ) ;
145188 reader . reset ( data ) ;
146189 const mpint = decoder . readMpint ( ) ;
@@ -149,8 +192,15 @@ describe('SshDecoder', () => {
149192
150193 test ( 'decodes mpint -0xdeadbeef' , ( ) => {
151194 const data = new Uint8Array ( [
152- 0 , 0 , 0 , 5 , // length
153- 0xff , 0x21 , 0x52 , 0x41 , 0x11
195+ 0 ,
196+ 0 ,
197+ 0 ,
198+ 5 , // length
199+ 0xff ,
200+ 0x21 ,
201+ 0x52 ,
202+ 0x41 ,
203+ 0x11 ,
154204 ] ) ;
155205 reader . reset ( data ) ;
156206 const mpint = decoder . readMpint ( ) ;
@@ -166,17 +216,34 @@ describe('SshDecoder', () => {
166216
167217 test ( 'decodes single name "zlib"' , ( ) => {
168218 const data = new Uint8Array ( [
169- 0 , 0 , 0 , 4 , // length
170- 0x7a , 0x6c , 0x69 , 0x62 // "zlib"
219+ 0 ,
220+ 0 ,
221+ 0 ,
222+ 4 , // length
223+ 0x7a ,
224+ 0x6c ,
225+ 0x69 ,
226+ 0x62 , // "zlib"
171227 ] ) ;
172228 reader . reset ( data ) ;
173229 expect ( decoder . readNameList ( ) ) . toEqual ( [ 'zlib' ] ) ;
174230 } ) ;
175231
176232 test ( 'decodes name-list "zlib,none"' , ( ) => {
177233 const data = new Uint8Array ( [
178- 0 , 0 , 0 , 9 , // length
179- 0x7a , 0x6c , 0x69 , 0x62 , 0x2c , 0x6e , 0x6f , 0x6e , 0x65 // "zlib,none"
234+ 0 ,
235+ 0 ,
236+ 0 ,
237+ 9 , // length
238+ 0x7a ,
239+ 0x6c ,
240+ 0x69 ,
241+ 0x62 ,
242+ 0x2c ,
243+ 0x6e ,
244+ 0x6f ,
245+ 0x6e ,
246+ 0x65 , // "zlib,none"
180247 ] ) ;
181248 reader . reset ( data ) ;
182249 expect ( decoder . readNameList ( ) ) . toEqual ( [ 'zlib' , 'none' ] ) ;
@@ -191,7 +258,7 @@ describe('SshDecoder', () => {
191258 data [ 2 ] = 0 ;
192259 data [ 3 ] = bytes . length ;
193260 data . set ( bytes , 4 ) ;
194-
261+
195262 reader . reset ( data ) ;
196263 expect ( decoder . readNameList ( ) ) . toEqual ( [ 'one' , 'two' , 'three' ] ) ;
197264 } ) ;
0 commit comments