Skip to content

Commit 163ec40

Browse files
committed
chore(wp): add unit test for unspents param
TICKET: BTC-1501
1 parent 5e3f611 commit 163ec40

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,13 @@ describe('V2 Wallet:', function () {
14611461
});
14621462
});
14631463

1464-
describe('maxNumInputsToUse verification', function () {
1464+
describe('fanout input maxNumInputsToUse and unspents verification', function () {
14651465
const address = '5b34252f1bf349930e34020a';
14661466
const maxNumInputsToUse = 2;
1467+
const unspents = [
1468+
'cc30565750e2aeb818625aaedaf89db5c614e5977b9645cee1d7289f616fb1d8:0',
1469+
'8c45164787a954ab07864af9b05b34fbde3a8e430a8c65b0e60e4e543d8e1b6c:2',
1470+
];
14671471
let basecoin;
14681472
let wallet;
14691473

@@ -1492,8 +1496,42 @@ describe('V2 Wallet:', function () {
14921496

14931497
response.isDone().should.be.true();
14941498
});
1499+
1500+
it('should pass unspents parameter when calling fanout unspents', async function () {
1501+
const path = `/api/v2/${wallet.coin()}/wallet/${wallet.id()}/fanoutUnspents`;
1502+
const response = nock(bgUrl)
1503+
.post(path, _.matches({ unspents })) // use _.matches to do a partial match on request body object instead of strict matching
1504+
.reply(200);
1505+
1506+
try {
1507+
await wallet.fanoutUnspents({ address, unspents });
1508+
} catch (e) {
1509+
// the fanoutUnspents method will probably throw an exception for not having all of the correct nocks
1510+
// we only care about /fanoutUnspents and whether unspents is an allowed parameter
1511+
}
1512+
1513+
response.isDone().should.be.true();
1514+
});
14951515
});
14961516

1517+
// describe('fanout specific unspents param verification', function () {
1518+
// const address = '5b34252f1bf349930e34020a';
1519+
1520+
// let basecoin;
1521+
// let wallet;
1522+
1523+
// before(async function () {
1524+
// basecoin = bitgo.coin('tbtc');
1525+
// const walletData = {
1526+
// id: '5b34252f1bf349930e34020a',
1527+
// coin: 'tbtc',
1528+
// keys: ['5b3424f91bf349930e340175'],
1529+
// };
1530+
// wallet = new Wallet(bitgo, basecoin, walletData);
1531+
// });
1532+
1533+
// });
1534+
14971535
describe('manage unspents', function () {
14981536
let rootWalletKey;
14991537
let walletPassphrase;

0 commit comments

Comments
 (0)