@@ -9,7 +9,7 @@ import * as sinon from 'sinon';
99import * as configModule from '../../../initConfig' ;
1010import { DklsTypes , DklsUtils } from '@bitgo-beta/sdk-lib-mpc' ;
1111
12- describe ( 'recoveryMpcV2' , async ( ) => {
12+ describe ( 'recoveryMpcV2' , ( ) => {
1313 let cfg : AdvancedWalletManagerConfig ;
1414 let app : express . Application ;
1515 let agent : request . SuperAgentTest ;
@@ -25,31 +25,39 @@ describe('recoveryMpcV2', async () => {
2525 let configStub : sinon . SinonStub ;
2626
2727 // key provider nocks setup
28- const [ userShare , backupShare ] = await DklsUtils . generateDKGKeyShares ( ) ;
29- const userKeyShare = userShare . getKeyShare ( ) . toString ( 'base64' ) ;
30- const backupKeyShare = backupShare . getKeyShare ( ) . toString ( 'base64' ) ;
31- const commonKeychain = DklsTypes . getCommonKeychain ( userShare . getKeyShare ( ) ) ;
32-
33- const mockKeyProviderUserResponse = {
34- prv : JSON . stringify ( userKeyShare ) ,
35- pub : commonKeychain ,
36- source : 'user' ,
37- type : 'tss' ,
38- } ;
39-
40- const mockKeyProviderBackupResponse = {
41- prv : JSON . stringify ( backupKeyShare ) ,
42- pub : commonKeychain ,
43- source : 'backup' ,
44- type : 'tss' ,
45- } ;
46- const input = {
47- txHex :
48- '02f6824268018502540be4008504a817c80083030d409443442e403d64d29c4f64065d0c1a0e8edc03d6c88801550f7dca700000823078c0' ,
49- pub : commonKeychain ,
50- } ;
28+ let userKeyShare : string ;
29+ let backupKeyShare : string ;
30+ let commonKeychain : string ;
31+ let mockKeyProviderUserResponse : { prv : string ; pub : string ; source : string ; type : string } ;
32+ let mockKeyProviderBackupResponse : { prv : string ; pub : string ; source : string ; type : string } ;
33+ let input : { txHex : string ; pub : string } ;
5134
5235 before ( async ( ) => {
36+ const [ userShare , backupShare ] = await DklsUtils . generateDKGKeyShares ( ) ;
37+ userKeyShare = userShare . getKeyShare ( ) . toString ( 'base64' ) ;
38+ backupKeyShare = backupShare . getKeyShare ( ) . toString ( 'base64' ) ;
39+ commonKeychain = DklsTypes . getCommonKeychain ( userShare . getKeyShare ( ) ) ;
40+
41+ mockKeyProviderUserResponse = {
42+ prv : JSON . stringify ( userKeyShare ) ,
43+ pub : commonKeychain ,
44+ source : 'user' ,
45+ type : 'tss' ,
46+ } ;
47+
48+ mockKeyProviderBackupResponse = {
49+ prv : JSON . stringify ( backupKeyShare ) ,
50+ pub : commonKeychain ,
51+ source : 'backup' ,
52+ type : 'tss' ,
53+ } ;
54+
55+ input = {
56+ txHex :
57+ '02f6824268018502540be4008504a817c80083030d409443442e403d64d29c4f64065d0c1a0e8edc03d6c88801550f7dca700000823078c0' ,
58+ pub : commonKeychain ,
59+ } ;
60+
5361 // nock config
5462 nock . disableNetConnect ( ) ;
5563 nock . enableNetConnect ( '127.0.0.1' ) ;
@@ -68,10 +76,6 @@ describe('recoveryMpcV2', async () => {
6876 recoveryMode : true ,
6977 } ;
7078
71- // Restore any existing stub from other test suites before re-stubbing
72- if ( typeof ( configModule . initConfig as any ) . restore === 'function' ) {
73- ( configModule . initConfig as any ) . restore ( ) ;
74- }
7579 configStub = sandbox . stub ( configModule , 'initConfig' ) . returns ( cfg ) ;
7680
7781 // app setup
0 commit comments