@@ -464,6 +464,11 @@ describe('json-web3', () => {
464464 { name : 'Int8Array' , ctor : Int8Array , values : [ - 128 , - 1 , 0 , 127 ] } ,
465465 { name : 'Int16Array' , ctor : Int16Array , values : [ - 32768 , - 1 , 0 , 32767 ] } ,
466466 { name : 'Int32Array' , ctor : Int32Array , values : [ - 2147483648 , - 1 , 0 , 2147483647 ] } ,
467+ {
468+ name : 'Float16Array' ,
469+ ctor : typeof Float16Array !== 'undefined' ? Float16Array : undefined ,
470+ values : [ 1.5 , - 2.25 , 3.125 ] ,
471+ } ,
467472 { name : 'Float32Array' , ctor : Float32Array , values : [ 1.5 , - 2.25 , 3 ] } ,
468473 { name : 'Float64Array' , ctor : Float64Array , values : [ 1.5 , - 2.25 , 3 ] } ,
469474 {
@@ -486,7 +491,8 @@ describe('json-web3', () => {
486491
487492 expect ( text ) . toContain ( '__@json.typedarray__' )
488493 expect ( output . data ) . toBeInstanceOf ( ctor )
489- expect ( Array . from ( output . data ) ) . toEqual ( values )
494+ const expected = name === 'Float16Array' ? Array . from ( new ctor ( values as any ) ) : values
495+ expect ( Array . from ( output . data ) ) . toEqual ( expected )
490496 }
491497 } )
492498
0 commit comments