Skip to content

Commit 8564bcd

Browse files
committed
test(sdk-coin-dot): cover missing userKey/backupKey guard clauses
Add regression tests for the missing-userKey and missing-backupKey guards in isMpcv2SigningMaterial(), which were introduced in the previous commit but had no dedicated coverage. Without these, a regression to the guard order or message would surface as a confusing downstream decrypt/parse error instead of the intended clear validation error. Ticket: WCI-1236 Session-Id: 851002b4-f316-42fd-a2ea-f9189b46e8a9 Task-Id: d2ffc5e1-d6cc-4c7d-8e3e-be446e5dc185
1 parent 5489872 commit 8564bcd

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,28 @@ describe('DOT:', function () {
525525
.should.be.rejectedWith('EdDSA MPCv2 recovery: commonKeyChain from keycard does not match bitgoKey');
526526
});
527527

528+
it('should throw missing userKey when walletPassphrase is set but userKey is omitted', async function () {
529+
await basecoin
530+
.recover({
531+
backupKey: mpcV2BackupKey,
532+
bitgoKey: mpcV2CommonKeyChain,
533+
walletPassphrase,
534+
recoveryDestination: destAddr,
535+
})
536+
.should.be.rejectedWith('missing userKey');
537+
});
538+
539+
it('should throw missing backupKey when walletPassphrase is set but backupKey is omitted', async function () {
540+
await basecoin
541+
.recover({
542+
userKey: mpcV2UserKey,
543+
bitgoKey: mpcV2CommonKeyChain,
544+
walletPassphrase,
545+
recoveryDestination: destAddr,
546+
})
547+
.should.be.rejectedWith('missing backupKey');
548+
});
549+
528550
it('should skip keycard decryption when multisigTypeVersion is pre-resolved to MPCv2', async function () {
529551
const isMpcv2Spy = sandBox.spy(Dot.prototype, 'isMpcv2SigningMaterial' as keyof Dot);
530552

0 commit comments

Comments
 (0)