@@ -238,6 +238,9 @@ describe('ChainConfigurationForm', () => {
238238 tronKeys : {
239239 results : [ ] ,
240240 } ,
241+ tonKeys : {
242+ results : [ ] ,
243+ } ,
241244 } )
242245
243246 const chainType = getByRole ( 'button' , { name : 'EVM' } )
@@ -395,6 +398,61 @@ test('should able to create Tron chain config', async () => {
395398 } )
396399} )
397400
401+ test ( 'should able to create TON chain config' , async ( ) => {
402+ const handleSubmit = jest . fn ( )
403+ const initialValues = emptyFormValues ( )
404+ initialValues . chainType = ChainTypes . EVM
405+ initialValues . adminAddr = '0x1234567'
406+
407+ const { container } = renderChainConfigurationForm (
408+ initialValues ,
409+ handleSubmit ,
410+ )
411+
412+ const chainType = getByRole ( 'button' , { name : 'EVM' } )
413+ userEvent . click ( chainType )
414+ userEvent . click ( getByRole ( 'option' , { name : 'TON' } ) )
415+ await screen . findByRole ( 'button' , { name : 'TON' } )
416+
417+ await selectChainIdOnUI ( container , '5555' )
418+
419+ const address = container . querySelector ( '#select-accountAddr' )
420+ expect ( address ) . toBeInTheDocument ( )
421+ address && userEvent . click ( address )
422+ userEvent . click ( getByRole ( 'option' , { name : 'ton_xxxx' } ) )
423+ await screen . findByRole ( 'button' , { name : 'ton_xxxx' } )
424+
425+ await userEvent . click ( getByRole ( 'button' , { name : / s u b m i t / i } ) )
426+
427+ await waitFor ( ( ) => {
428+ expect ( handleSubmit ) . toHaveBeenCalledWith ( {
429+ accountAddr : 'ton_xxxx' ,
430+ accountAddrPubKey : '' ,
431+ adminAddr : '0x1234567' ,
432+ chainID : '5555' ,
433+ chainType : 'TON' ,
434+ fluxMonitorEnabled : false ,
435+ ocr1Enabled : false ,
436+ ocr1IsBootstrap : false ,
437+ ocr1KeyBundleID : '' ,
438+ ocr1Multiaddr : '' ,
439+ ocr1P2PPeerID : '' ,
440+ ocr2CommitPluginEnabled : false ,
441+ ocr2Enabled : false ,
442+ ocr2ExecutePluginEnabled : false ,
443+ ocr2ForwarderAddress : '' ,
444+ ocr2IsBootstrap : false ,
445+ ocr2KeyBundleID : '' ,
446+ ocr2MedianPluginEnabled : false ,
447+ ocr2MercuryPluginEnabled : false ,
448+ ocr2Multiaddr : '' ,
449+ ocr2P2PPeerID : '' ,
450+ ocr2RebalancerPluginEnabled : false ,
451+ } )
452+ expect ( handleSubmit ) . toHaveBeenCalledTimes ( 1 )
453+ } )
454+ } )
455+
398456test ( 'should be able to select OCR2 Job Type with Key Bundle ID' , async ( ) => {
399457 const handleSubmit = jest . fn ( )
400458 const initialValues = emptyFormValues ( )
@@ -417,6 +475,9 @@ test('should be able to select OCR2 Job Type with Key Bundle ID', async () => {
417475 tronKeys : {
418476 results : [ ] ,
419477 } ,
478+ tonKeys : {
479+ results : [ ] ,
480+ } ,
420481 } ,
421482 )
422483
@@ -482,6 +543,11 @@ function renderChainConfigurationForm(
482543 enabled : true ,
483544 network : 'tron' ,
484545 } ,
546+ {
547+ id : '5555' ,
548+ enabled : true ,
549+ network : 'ton' ,
550+ } ,
485551 ] ,
486552 accountsNonEvm : FetchNonEvmKeys | undefined = {
487553 aptosKeys : {
@@ -496,6 +562,9 @@ function renderChainConfigurationForm(
496562 tronKeys : {
497563 results : [ { id : 'tron_xxxx' } ] ,
498564 } ,
565+ tonKeys : {
566+ results : [ { addressBase64 : '123' , rawAddress : '0:456' , id : 'ton_xxxx' } ] ,
567+ } ,
499568 } ,
500569) {
501570 return render (
0 commit comments