Skip to content

Commit 94313cf

Browse files
pranavjain97claude
andcommitted
fix: add missing keychain nocks in sendMany multisig test
The 'should ignore commonKeychain param for multisig wallet' test was missing nock mocks for backup-key-id and bitgo-key-id. The handler fetches all 3 keychains to build walletPubs for AWM signing, causing a 500 when the nocks were absent. Also use .times(2) for user-key-id since it's fetched both as the signing keychain and in the walletPubs lookup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b5838f4 commit 94313cf

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/__tests__/api/master/sendMany.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,29 @@ describe('POST /api/v1/:coin/advancedwallet/:walletId/sendMany', () => {
10261026

10271027
const keychainGetNock = nock(bitgoApiUrl)
10281028
.get(`/api/v2/${coin}/key/user-key-id`)
1029+
.times(2)
10291030
.matchHeader('any', () => true)
10301031
.reply(200, {
10311032
id: 'user-key-id',
10321033
pub: 'xpub_user',
10331034
});
10341035

1036+
const backupKeychainGetNock = nock(bitgoApiUrl)
1037+
.get(`/api/v2/${coin}/key/backup-key-id`)
1038+
.matchHeader('any', () => true)
1039+
.reply(200, {
1040+
id: 'backup-key-id',
1041+
pub: 'xpub_backup',
1042+
});
1043+
1044+
const bitgoKeychainGetNock = nock(bitgoApiUrl)
1045+
.get(`/api/v2/${coin}/key/bitgo-key-id`)
1046+
.matchHeader('any', () => true)
1047+
.reply(200, {
1048+
id: 'bitgo-key-id',
1049+
pub: 'xpub_bitgo',
1050+
});
1051+
10351052
const prebuildStub = sinon.stub(Wallet.prototype, 'prebuildTransaction').resolves({
10361053
txHex: 'prebuilt-tx-hex',
10371054
txInfo: { nP2SHInputs: 1, nSegwitInputs: 0, nOutputs: 2 },
@@ -1072,6 +1089,8 @@ describe('POST /api/v1/:coin/advancedwallet/:walletId/sendMany', () => {
10721089

10731090
walletGetNock.done();
10741091
keychainGetNock.done();
1092+
backupKeychainGetNock.done();
1093+
bitgoKeychainGetNock.done();
10751094
sinon.assert.calledOnce(prebuildStub);
10761095
sinon.assert.calledOnce(verifyStub);
10771096
signNock.done();

0 commit comments

Comments
 (0)