@@ -21,6 +21,10 @@ import {
2121} from '../resources/atom' ;
2222import should = require( 'should' ) ;
2323
24+ import { loadWebAssembly } from '@bitgo/sdk-opensslbytes' ;
25+
26+ const openSSLBytes = loadWebAssembly ( ) . buffer ;
27+
2428describe ( 'ATOM' , function ( ) {
2529 let bitgo : TestBitGoAPI ;
2630 let basecoin ;
@@ -429,13 +433,16 @@ describe('ATOM', function () {
429433 } ) ;
430434
431435 it ( 'should recover funds for non-bitgo recoveries' , async function ( ) {
432- const res = await basecoin . recover ( {
433- userKey : wrwUser . userKey ,
434- backupKey : wrwUser . backupKey ,
435- bitgoKey : wrwUser . bitgoKey ,
436- walletPassphrase : wrwUser . walletPassphrase ,
437- recoveryDestination : destinationAddress ,
438- } ) ;
436+ const res = await basecoin . recover (
437+ {
438+ userKey : wrwUser . userKey ,
439+ backupKey : wrwUser . backupKey ,
440+ bitgoKey : wrwUser . bitgoKey ,
441+ walletPassphrase : wrwUser . walletPassphrase ,
442+ recoveryDestination : destinationAddress ,
443+ } ,
444+ openSSLBytes
445+ ) ;
439446 res . should . not . be . empty ( ) ;
440447 res . should . hasOwnProperty ( 'serializedTx' ) ;
441448 sandBox . assert . calledOnce ( basecoin . getAccountBalance ) ;
@@ -453,13 +460,16 @@ describe('ATOM', function () {
453460 } ) ;
454461
455462 it ( 'should recover funds for non-bitgo recoveries - DKLS type' , async function ( ) {
456- const res = await basecoin . recover ( {
457- userKey : wrwUserDkls . userKey ,
458- backupKey : wrwUserDkls . backupKey ,
459- bitgoKey : wrwUserDkls . bitgoKey ,
460- walletPassphrase : wrwUserDkls . walletPassphrase ,
461- recoveryDestination : wrwUserDkls . destinationAddress ,
462- } ) ;
463+ const res = await basecoin . recover (
464+ {
465+ userKey : wrwUserDkls . userKey ,
466+ backupKey : wrwUserDkls . backupKey ,
467+ bitgoKey : wrwUserDkls . bitgoKey ,
468+ walletPassphrase : wrwUserDkls . walletPassphrase ,
469+ recoveryDestination : wrwUserDkls . destinationAddress ,
470+ } ,
471+ openSSLBytes
472+ ) ;
463473 res . should . not . be . empty ( ) ;
464474 res . should . hasOwnProperty ( 'serializedTx' ) ;
465475 sandBox . assert . calledOnce ( basecoin . getAccountBalance ) ;
@@ -477,15 +487,18 @@ describe('ATOM', function () {
477487 } ) ;
478488
479489 it ( 'should redelegate funds to new validator' , async function ( ) {
480- const res = await basecoin . redelegate ( {
481- userKey : wrwUser . userKey ,
482- backupKey : wrwUser . backupKey ,
483- bitgoKey : wrwUser . bitgoKey ,
484- walletPassphrase : wrwUser . walletPassphrase ,
485- amountToRedelegate : '10000000000000000' ,
486- validatorSrcAddress : 'cosmosvaloper1409te27da74uahh6hn0040x7l272hjs2padjuz' ,
487- validatorDstAddress : 'cosmosvaloper183aycgtstp67r6s4vd7ts2npp2ckk4xah7rxj6' ,
488- } ) ;
490+ const res = await basecoin . redelegate (
491+ {
492+ userKey : wrwUser . userKey ,
493+ backupKey : wrwUser . backupKey ,
494+ bitgoKey : wrwUser . bitgoKey ,
495+ walletPassphrase : wrwUser . walletPassphrase ,
496+ amountToRedelegate : '10000000000000000' ,
497+ validatorSrcAddress : 'cosmosvaloper1409te27da74uahh6hn0040x7l272hjs2padjuz' ,
498+ validatorDstAddress : 'cosmosvaloper183aycgtstp67r6s4vd7ts2npp2ckk4xah7rxj6' ,
499+ } ,
500+ openSSLBytes
501+ ) ;
489502
490503 res . should . not . be . empty ( ) ;
491504 res . should . hasOwnProperty ( 'serializedTx' ) ;
@@ -561,7 +574,7 @@ describe('ATOM', function () {
561574 . should . rejectedWith ( 'missing wallet passphrase' ) ;
562575 } ) ;
563576
564- it ( 'should throw error if there is no balance ' , async function ( ) {
577+ it ( 'should throw error if openSSLBytes is not present ' , async function ( ) {
565578 await basecoin
566579 . recover ( {
567580 userKey : wrwUser . userKey ,
@@ -570,6 +583,21 @@ describe('ATOM', function () {
570583 walletPassphrase : wrwUser . walletPassphrase ,
571584 recoveryDestination : destinationAddress ,
572585 } )
586+ . should . rejectedWith ( 'missing openSSLBytes' ) ;
587+ } ) ;
588+
589+ it ( 'should throw error if there is no balance' , async function ( ) {
590+ await basecoin
591+ . recover (
592+ {
593+ userKey : wrwUser . userKey ,
594+ backupKey : wrwUser . backupKey ,
595+ bitgoKey : wrwUser . bitgoKey ,
596+ walletPassphrase : wrwUser . walletPassphrase ,
597+ recoveryDestination : destinationAddress ,
598+ } ,
599+ openSSLBytes
600+ )
573601 . should . rejectedWith ( 'Did not have enough funds to recover' ) ;
574602 } ) ;
575603 } ) ;
0 commit comments