@@ -151,10 +151,7 @@ describe('createContract', () => {
151151 expect ( unsignedTx ) . toHaveProperty ( 'hash' )
152152 expect ( unsignedTx . tx . action . contract ) . toBe ( 'LockupPrime' )
153153 expect ( unsignedTx . tx . action . function ) . toBe ( 'lock' )
154- expect ( unsignedTx . tx . action . args ) . toEqual ( [
155- toAtomicAma ( 50 ) . toString ( ) ,
156- '7d'
157- ] )
154+ expect ( unsignedTx . tx . action . args ) . toEqual ( [ toAtomicAma ( 50 ) . toString ( ) , '7d' ] )
158155 } )
159156
160157 it ( 'buildAndSignCall builds and signs from ContractCall' , ( ) => {
@@ -339,9 +336,9 @@ describe('createContract', () => {
339336 // Both produce valid output (nonces differ due to timestamp, but structure is same)
340337 expect ( viaSignCall . txHash ) . toBeTypeOf ( 'string' )
341338 expect ( viaSigned . txHash ) . toBeTypeOf ( 'string' )
342- expect (
343- Math . abs ( viaSignCall . txPacked . length - viaSigned . txPacked . length )
344- ) . toBeLessThan ( 5 )
339+ expect ( Math . abs ( viaSignCall . txPacked . length - viaSigned . txPacked . length ) ) . toBeLessThan (
340+ 5
341+ )
345342 } )
346343
347344 it ( 'builder.contract(ABI).lock() produces same size as builder.lockupPrimeLock()' , ( ) => {
@@ -355,9 +352,9 @@ describe('createContract', () => {
355352
356353 expect ( viaContract . txHash ) . toBeTypeOf ( 'string' )
357354 expect ( viaBuiltIn . txHash ) . toBeTypeOf ( 'string' )
358- expect (
359- Math . abs ( viaContract . txPacked . length - viaBuiltIn . txPacked . length )
360- ) . toBeLessThan ( 5 )
355+ expect ( Math . abs ( viaContract . txPacked . length - viaBuiltIn . txPacked . length ) ) . toBeLessThan (
356+ 5
357+ )
361358 } )
362359 } )
363360
@@ -387,7 +384,9 @@ describe('createContract', () => {
387384
388385 it ( 'throws on empty contractName' , ( ) => {
389386 // @ts -expect-error — testing runtime validation
390- expect ( ( ) => createContract ( { contractName : '' , abi : [ ] } ) ) . toThrow ( / m i s s i n g o r e m p t y " c o n t r a c t N a m e " / )
387+ expect ( ( ) => createContract ( { contractName : '' , abi : [ ] } ) ) . toThrow (
388+ / m i s s i n g o r e m p t y " c o n t r a c t N a m e " /
389+ )
391390 } )
392391
393392 it ( 'throws on missing abi array' , ( ) => {
@@ -397,44 +396,64 @@ describe('createContract', () => {
397396
398397 it ( 'throws on non-array abi' , ( ) => {
399398 // @ts -expect-error — testing runtime validation
400- expect ( ( ) => createContract ( { contractName : 'Test' , abi : 'bad' } ) ) . toThrow ( / " a b i " m u s t b e a n a r r a y / )
399+ expect ( ( ) => createContract ( { contractName : 'Test' , abi : 'bad' } ) ) . toThrow (
400+ / " a b i " m u s t b e a n a r r a y /
401+ )
401402 } )
402403
403404 it ( 'throws on function entry with wrong type' , ( ) => {
404- expect ( ( ) => createContract ( {
405- contractName : 'Test' ,
406- abi : [
407- // @ts -expect-error — testing runtime validation
408- { type : 'event' , name : 'foo' , inputs : [ ] , outputs : [ ] , stateMutability : 'view' }
409- ]
410- } ) ) . toThrow ( / h a s t y p e " e v e n t " , e x p e c t e d " f u n c t i o n " / )
405+ expect ( ( ) =>
406+ createContract ( {
407+ contractName : 'Test' ,
408+ abi : [
409+ // @ts -expect-error — testing runtime validation
410+ {
411+ type : 'event' ,
412+ name : 'foo' ,
413+ inputs : [ ] ,
414+ outputs : [ ] ,
415+ stateMutability : 'view'
416+ }
417+ ]
418+ } )
419+ ) . toThrow ( / h a s t y p e " e v e n t " , e x p e c t e d " f u n c t i o n " / )
411420 } )
412421
413422 it ( 'throws on function entry missing name' , ( ) => {
414- expect ( ( ) => createContract ( {
415- contractName : 'Test' ,
416- abi : [
417- // @ts -expect-error — testing runtime validation
418- { type : 'function' , inputs : [ ] , outputs : [ ] , stateMutability : 'view' }
419- ]
420- } ) ) . toThrow ( / m i s s i n g " n a m e " / )
423+ expect ( ( ) =>
424+ createContract ( {
425+ contractName : 'Test' ,
426+ abi : [
427+ // @ts -expect-error — testing runtime validation
428+ { type : 'function' , inputs : [ ] , outputs : [ ] , stateMutability : 'view' }
429+ ]
430+ } )
431+ ) . toThrow ( / m i s s i n g " n a m e " / )
421432 } )
422433
423434 it ( 'throws on function entry missing inputs' , ( ) => {
424- expect ( ( ) => createContract ( {
425- contractName : 'Test' ,
426- abi : [
427- // @ts -expect-error — testing runtime validation
428- { type : 'function' , name : 'foo' , outputs : [ ] , stateMutability : 'view' }
429- ]
430- } ) ) . toThrow ( / m i s s i n g " i n p u t s " a r r a y / )
435+ expect ( ( ) =>
436+ createContract ( {
437+ contractName : 'Test' ,
438+ abi : [
439+ // @ts -expect-error — testing runtime validation
440+ { type : 'function' , name : 'foo' , outputs : [ ] , stateMutability : 'view' }
441+ ]
442+ } )
443+ ) . toThrow ( / m i s s i n g " i n p u t s " a r r a y / )
431444 } )
432445
433446 it ( 'accepts valid minimal ABI' , ( ) => {
434447 const contract = createContract ( {
435448 contractName : 'Minimal' ,
436449 abi : [
437- { type : 'function' , name : 'ping' , inputs : [ ] , outputs : [ ] , stateMutability : 'nonpayable' }
450+ {
451+ type : 'function' ,
452+ name : 'ping' ,
453+ inputs : [ ] ,
454+ outputs : [ ] ,
455+ stateMutability : 'nonpayable'
456+ }
438457 ]
439458 } as const )
440459
0 commit comments