Skip to content

Commit 2f801bc

Browse files
committed
test(sdk-coin-polyx): cover MPCv1 decrypt-failure error path
Add a test asserting the addRecoverySignature() MPCv1 branch rethrows a descriptive 'Error decrypting user keychain' message when bitgo.decrypt() rejects (e.g. wrong wallet passphrase). The automated review dispatched after the prior test-coverage commits flagged this catch/rethrow branch, moved out of recover() and into addRecoverySignature() in the MPCv2 recovery commit, as still unexercised by any test. Ticket: WCI-1228 Session-Id: 3a00bebe-fe12-4aea-9f1a-5a2d0dd8e94b Task-Id: dfadd58f-a04c-4dd9-819b-506439735cec
1 parent 561b0e1 commit 2f801bc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • modules/sdk-coin-polyx/test/unit

modules/sdk-coin-polyx/test/unit/polyx.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,16 @@ describe('Polyx:', function () {
272272
sandBox.assert.calledOnce(getTSSSignatureStub);
273273
});
274274

275+
it('should throw a descriptive error when user keychain decryption fails on the MPCv1 path', async function () {
276+
sandBox
277+
.stub(baseCoin as unknown as { isMpcv2SigningMaterial(): void }, 'isMpcv2SigningMaterial')
278+
.resolves(false);
279+
280+
sandBox.stub(bitgo, 'decrypt').rejects(new Error('password error'));
281+
282+
await baseCoin.recover(mpcV2RecoverParams).should.be.rejectedWith(/Error decrypting user keychain/);
283+
});
284+
275285
it('should throw when commonKeyChain from MPCv2 keycard does not match bitgoKey', async function () {
276286
const mismatchedBitgoKey = mpcV2CommonKeyChain.slice(0, -8) + '00000000';
277287
const mismatchedParams = {

0 commit comments

Comments
 (0)