Skip to content

Commit c27421e

Browse files
test(wallet): add test for isTestTransaction in sendMany
Add unit test to verify that isTestTransaction parameter is properly passed through the sendMany -> prebuildAndSignTransaction flow for TSS wallets. This ensures the parameter flows correctly via inheritance from SendManyOptions -> PrebuildAndSignTransactionOptions -> PrebuildTransactionOptions.
1 parent b52c7b8 commit c27421e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

modules/bitgo/test/v2/unit/wallet.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,6 +3952,34 @@ describe('V2 Wallet:', function () {
39523952
setRequestTracerSpy.restore();
39533953
});
39543954

3955+
it('should pass isTestTransaction through sendMany to prebuildAndSignTransaction', async function () {
3956+
const signedTransaction = {
3957+
txRequestId: 'txRequestId',
3958+
};
3959+
3960+
const sendManyInputWithTestFlag = {
3961+
...sendManyInput,
3962+
type: 'transfer',
3963+
isTestTransaction: true,
3964+
};
3965+
3966+
const prebuildAndSignTransaction = sandbox.stub(tssSolWallet, 'prebuildAndSignTransaction');
3967+
prebuildAndSignTransaction.resolves(signedTransaction);
3968+
3969+
const sendTxRequest = sandbox.stub(TssUtils.prototype, 'sendTxRequest');
3970+
sendTxRequest.resolves('sendTxResponse');
3971+
3972+
const sendMany = await tssSolWallet.sendMany(sendManyInputWithTestFlag);
3973+
3974+
// Verify prebuildAndSignTransaction was called with isTestTransaction
3975+
sinon.assert.calledOnce(prebuildAndSignTransaction);
3976+
const callArgs = prebuildAndSignTransaction.getCall(0).args[0];
3977+
callArgs.should.have.property('isTestTransaction', true);
3978+
callArgs.should.have.property('type', 'transfer');
3979+
3980+
sendMany.should.deepEqual('sendTxResponse');
3981+
});
3982+
39553983
it('should return transfer from sendMany for apiVersion=full', async function () {
39563984
const wallet = new Wallet(bitgo, tsol, {
39573985
...walletData,

0 commit comments

Comments
 (0)