@@ -54,7 +54,9 @@ describe('TradingAccount', function () {
5454 toJSON : sinon . stub ( ) . returns ( {
5555 id : 'test-wallet-id' ,
5656 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
57- coinSpecific : { } ,
57+ coinSpecific : {
58+ userKeySigningRequired : false ,
59+ } ,
5860 } ) ,
5961 baseCoin : mockBaseCoin ,
6062 bitgo : mockBitGo ,
@@ -85,7 +87,6 @@ describe('TradingAccount', function () {
8587 it ( 'should sign using the BitGo key remotely when no passphrase is provided' , async function ( ) {
8688 const result = await tradingAccount . signPayload ( { payload } ) ;
8789
88- mockWallet . toJSON . calledOnce . should . be . true ( ) ;
8990 mockBitGo . post . calledOnce . should . be . true ( ) ;
9091 sendStub . calledWith ( { payload : JSON . stringify ( payload ) } ) . should . be . true ( ) ;
9192 result . should . equal ( signature ) ;
@@ -98,11 +99,13 @@ describe('TradingAccount', function () {
9899 } ) ;
99100
100101 it ( 'should throw if coinSpecific.userKeySigningRequired is true and no passphrase and prv are provided' , async function ( ) {
101- mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount ) . returns ( {
102+ const mockWalletJSON = {
102103 id : 'test-wallet-id' ,
103104 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
104105 coinSpecific : { userKeySigningRequired : true } ,
105- } ) ;
106+ } ;
107+ mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount ) . returns ( mockWalletJSON ) ;
108+ mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount + 1 ) . returns ( mockWalletJSON ) ;
106109
107110 await tradingAccount
108111 . signPayload ( { payload } )
@@ -112,12 +115,14 @@ describe('TradingAccount', function () {
112115 } ) ;
113116
114117 it ( 'should fall back to top-level userKeySigningRequired when coinSpecific does not carry it' , async function ( ) {
115- mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount ) . returns ( {
118+ const mockWalletJSON = {
116119 id : 'test-wallet-id' ,
117120 keys : [ 'user-key-id' , 'backup-key-id' , 'bitgo-key-id' ] ,
118121 coinSpecific : { } ,
119122 userKeySigningRequired : true ,
120- } ) ;
123+ } ;
124+ mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount ) . returns ( mockWalletJSON ) ;
125+ mockWallet . toJSON . onCall ( mockWallet . toJSON . callCount + 1 ) . returns ( mockWalletJSON ) ;
121126
122127 await tradingAccount
123128 . signPayload ( { payload } )
0 commit comments