File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -83,4 +83,31 @@ describe('DynamicValue', () => {
8383 expect ( valueFromDynamicValue ( extendedArrayDynamicValue ) ) . toStrictEqual ( extendedArrayValue )
8484 } )
8585 } )
86+
87+ describe ( 'number values in object' , function ( ) {
88+ const mock = {
89+ uint : 1999 ,
90+ int : - 293 ,
91+ float : 2222.11231 ,
92+ smallBigInt : BigInt ( 2 ) ,
93+ bigBigInt : BigInt ( 2000000000000 ) ,
94+ stringUint : '11' ,
95+ stringInt : '-11' ,
96+ stringFloat : '11.2' ,
97+ }
98+
99+ const dynValue = valueToDynamicValue ( mock )
100+
101+ const result = valueFromDynamicValue ( dynValue )
102+
103+ expect ( valueFromDynamicValue ( dynValue ) ) . toStrictEqual ( mock )
104+ expect ( dynValue . value . uint . getType ( ) ) . toStrictEqual ( 'u32' )
105+ expect ( dynValue . value . int . getType ( ) ) . toStrictEqual ( 'i64' )
106+ expect ( dynValue . value . float . getType ( ) ) . toStrictEqual ( 'f64' )
107+ expect ( dynValue . value . smallBigInt . getType ( ) ) . toStrictEqual ( 'BigIntString' )
108+ expect ( dynValue . value . bigBigInt . getType ( ) ) . toStrictEqual ( 'BigIntString' )
109+ expect ( dynValue . value . stringUint . getType ( ) ) . toStrictEqual ( 'String' )
110+ expect ( dynValue . value . stringInt . getType ( ) ) . toStrictEqual ( 'String' )
111+ expect ( dynValue . value . stringFloat . getType ( ) ) . toStrictEqual ( 'String' )
112+ } )
86113} )
You can’t perform that action at this time.
0 commit comments