@@ -231,6 +231,46 @@ describe('BaseApp', () => {
231
231
} )
232
232
} )
233
233
234
+ it ( 'should retrieve version information (14 bytes)' , async ( ) => {
235
+ const responseBuffer = Buffer . concat ( [
236
+ Buffer . from ( [ 1 , 0 , 0 , 0 , 7 , 0 , 0 , 0 , 8 , 0 , 0 , 0 , 9 , 1 ] ) , // Version information
237
+ Buffer . from ( [ 0x90 , 0x00 ] ) , // Status code for no errors (0x9000)
238
+ ] )
239
+
240
+ const transport = new MockTransport ( responseBuffer )
241
+ const app = new BaseApp ( transport , params )
242
+ const version = await app . getVersion ( )
243
+
244
+ expect ( version ) . toEqual ( {
245
+ major : 7 ,
246
+ minor : 8 ,
247
+ patch : 9 ,
248
+ deviceLocked : true ,
249
+ targetId : '' ,
250
+ testMode : true ,
251
+ } )
252
+ } )
253
+
254
+ it ( 'should retrieve version information (18 bytes)' , async ( ) => {
255
+ const responseBuffer = Buffer . concat ( [
256
+ Buffer . from ( [ 1 , 0 , 0 , 1 , 5 , 0 , 0 , 0 , 6 , 0 , 0 , 0 , 7 , 0 , 0 , 0xa , 0xb , 0xc ] ) , // Version information
257
+ Buffer . from ( [ 0x90 , 0x00 ] ) , // Status code for no errors (0x9000)
258
+ ] )
259
+
260
+ const transport = new MockTransport ( responseBuffer )
261
+ const app = new BaseApp ( transport , params )
262
+ const version = await app . getVersion ( )
263
+
264
+ expect ( version ) . toEqual ( {
265
+ major : 261 ,
266
+ minor : 6 ,
267
+ patch : 7 ,
268
+ deviceLocked : false ,
269
+ targetId : '000a0b0c' ,
270
+ testMode : true ,
271
+ } )
272
+ } )
273
+
234
274
it ( 'should handle missing data' , async ( ) => {
235
275
const responseBuffer = Buffer . concat ( [
236
276
Buffer . from ( [ 0 , 1 , 2 , 3 ] ) , // Version information
0 commit comments