@@ -123,13 +123,12 @@ test('addSend', async () => {
123
123
. mockImplementation ( ( ) => { } ) ;
124
124
const spyOutput = jest . spyOn ( PartialTxProposal . prototype , 'addOutput' )
125
125
. mockImplementation ( ( ) => { } ) ;
126
- const spyUtxos = jest . spyOn ( HathorWallet . prototype , 'getAllUtxos' )
127
- . mockImplementation ( utxoMock ) ;
128
126
129
127
const hwallet = fakeHathorWallet ( {
130
128
getCurrentAddress : jest . fn ( ( ) => ( {
131
129
address : ADDR2 ,
132
130
} ) ) ,
131
+ getAllUtxos : jest . fn ( utxoMock ) ,
133
132
} ) ;
134
133
135
134
const proposal = new PartialTxProposal ( testnet ) ;
@@ -139,7 +138,6 @@ test('addSend', async () => {
139
138
*/
140
139
proposal . addSend ( hwallet , FAKE_UID , 10 ) ;
141
140
expect ( spyReset ) . toHaveBeenCalledTimes ( 1 ) ;
142
- expect ( spyUtxos ) . toBeCalledWith ( { token : FAKE_UID } ) ;
143
141
expect ( spyInput ) . toBeCalledWith (
144
142
hwallet ,
145
143
FAKE_TXID ,
@@ -149,21 +147,21 @@ test('addSend', async () => {
149
147
{ token : FAKE_UID , authorities : 0 , markAsSelected : true } ,
150
148
) ;
151
149
expect ( spyOutput ) . not . toHaveBeenCalled ( ) ;
150
+ expect ( hwallet . getAllUtxos ) . toBeCalledWith ( { token : FAKE_UID } ) ;
152
151
expect ( hwallet . getCurrentAddress ) . not . toHaveBeenCalled ( ) ;
153
152
154
153
// Mock cleanup
155
154
spyReset . mockClear ( ) ;
156
155
spyInput . mockClear ( ) ;
157
156
spyOutput . mockClear ( ) ;
158
- spyUtxos . mockClear ( ) ;
159
157
hwallet . getCurrentAddress . mockClear ( ) ;
158
+ hwallet . getAllUtxos . mockClear ( ) ;
160
159
161
160
/**
162
161
* Add 1 input with change passing utxos and address
163
162
*/
164
163
proposal . addSend ( hwallet , FAKE_UID , 4 , { utxos, changeAddress : ADDR3 } ) ;
165
164
expect ( spyReset ) . toHaveBeenCalledTimes ( 1 ) ;
166
- expect ( spyUtxos ) . not . toHaveBeenCalled ( ) ;
167
165
expect ( spyInput ) . toBeCalledWith (
168
166
hwallet ,
169
167
FAKE_TXID ,
@@ -179,20 +177,21 @@ test('addSend', async () => {
179
177
{ isChange : true } ,
180
178
) ;
181
179
expect ( hwallet . getCurrentAddress ) . not . toHaveBeenCalled ( ) ;
180
+ expect ( hwallet . getAllUtxos ) . not . toHaveBeenCalled ( ) ;
182
181
183
182
// Mock cleanup
184
183
spyReset . mockClear ( ) ;
185
184
spyInput . mockClear ( ) ;
186
185
spyOutput . mockClear ( ) ;
187
- spyUtxos . mockClear ( ) ;
186
+ hwallet . getAllUtxos . mockClear ( ) ;
188
187
hwallet . getCurrentAddress . mockClear ( ) ;
189
188
190
189
/**
191
190
* Add 1 input with change without address and markAsSelected false
192
191
*/
193
192
proposal . addSend ( hwallet , FAKE_UID , 8 , { markAsSelected : false } ) ;
194
193
expect ( spyReset ) . toHaveBeenCalledTimes ( 1 ) ;
195
- expect ( spyUtxos ) . toBeCalledWith ( { token : FAKE_UID } ) ;
194
+ expect ( hwallet . getAllUtxos ) . toBeCalledWith ( { token : FAKE_UID } ) ;
196
195
expect ( spyInput ) . toBeCalledWith (
197
196
hwallet ,
198
197
FAKE_TXID ,
@@ -213,7 +212,6 @@ test('addSend', async () => {
213
212
spyReset . mockRestore ( ) ;
214
213
spyInput . mockRestore ( ) ;
215
214
spyOutput . mockRestore ( ) ;
216
- spyUtxos . mockRestore ( ) ;
217
215
} ) ;
218
216
219
217
test ( 'addReceive' , async ( ) => {
@@ -267,8 +265,7 @@ test('addReceive', async () => {
267
265
268
266
test ( 'addInput' , async ( ) => {
269
267
const spyReset = jest . spyOn ( PartialTxProposal . prototype , 'resetSignatures' ) ;
270
- const spyInput = jest . spyOn ( PartialTx . prototype , 'addInput' )
271
- . mockImplementation ( ( ) => { } ) ;
268
+ const spyInput = jest . spyOn ( PartialTx . prototype , 'addInput' ) ;
272
269
273
270
const hwallet = fakeHathorWallet ( {
274
271
markUtxoSelected : jest . fn ( ( hash , index ) => { } ) ,
0 commit comments