Skip to content

Commit 4df9c97

Browse files
fix(key-card): update assert imports for Node 22
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> TICKET: WP-5599
1 parent 1d54643 commit 4df9c97

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

modules/key-card/src/generateParamsForKeyCreation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function generateParamsForKeyCreation({
77
walletLabel,
88
keyCardImage,
99
}: GenerateQrDataForKeychainParams & GenerateQrDataBaseParams): IDrawKeyCard {
10-
assert(bitgoKeychain.commonKeychain, 'bitgoKeychain.commonKeychain is required');
10+
assert.ok(bitgoKeychain.commonKeychain, 'bitgoKeychain.commonKeychain is required');
1111
return {
1212
walletLabel,
1313
keyCardImage,

modules/key-card/src/generateQrData.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function generateUserQrData(userKeychain: Keychain, userMasterKey?: string): QrD
3232
}
3333

3434
const pub = getPubFromKey(userKeychain);
35-
assert(pub);
35+
assert.ok(pub);
3636

3737
return {
3838
title: 'A: Provided User Key',
@@ -71,7 +71,7 @@ function generateBackupQrData(
7171

7272
if (backupKeyProvider === 'BitGo Trust' && backupKeychain.type === 'tss') {
7373
const keyShares = backupKeychain.keyShares?.filter((keyShare) => keyShare.to === 'backup');
74-
assert(keyShares?.length === 2);
74+
assert.ok(keyShares?.length === 2);
7575
return {
7676
title: 'B: Backup Key Shares',
7777
description:
@@ -82,7 +82,7 @@ function generateBackupQrData(
8282
}
8383

8484
const pub = getPubFromKey(backupKeychain);
85-
assert(pub);
85+
assert.ok(pub);
8686

8787
if (backupKeyProvider) {
8888
return {
@@ -104,7 +104,7 @@ function generateBackupQrData(
104104

105105
function generateBitGoQrData(bitgoKeychain: Keychain): QrDataEntry {
106106
const bitgoData = getPubFromKey(bitgoKeychain);
107-
assert(bitgoData);
107+
assert.ok(bitgoData);
108108

109109
return {
110110
title: 'C: BitGo Public Key',

modules/key-card/test/unit/generateParamsForKeyCreation.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ describe('generateParamsForKeyCreation', function () {
1515
const keyCardImage: HTMLImageElement = 'random image' as unknown as HTMLImageElement;
1616

1717
const result = generateParamsForKeyCreation({ bitgoKeychain, curve, walletLabel, keyCardImage });
18-
assert(result);
19-
assert(result.qrData.user);
20-
assert(result.qrData.user.data === bitgoKeychain.commonKeychain);
21-
assert(result.qrData.bitgo && result.qrData.bitgo.data === bitgoKeychain.id);
22-
assert(result.questions && result.questions.length === 2);
23-
assert(result.walletLabel === walletLabel);
24-
assert(result.curve === curve);
25-
assert(result.keyCardImage === keyCardImage);
18+
assert.ok(result);
19+
assert.ok(result.qrData.user);
20+
assert.ok(result.qrData.user.data === bitgoKeychain.commonKeychain);
21+
assert.ok(result.qrData.bitgo && result.qrData.bitgo.data === bitgoKeychain.id);
22+
assert.ok(result.questions && result.questions.length === 2);
23+
assert.ok(result.walletLabel === walletLabel);
24+
assert.ok(result.curve === curve);
25+
assert.ok(result.keyCardImage === keyCardImage);
2626
});
2727
});

modules/key-card/test/unit/generateQrData.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ describe('generateQrData', function () {
6060
qrData.user.description.should.equal('This is your private key, encrypted with your wallet password.');
6161
qrData.user.data.should.equal(userEncryptedPrv);
6262

63-
assert(qrData.backup);
63+
assert.ok(qrData.backup);
6464
qrData.backup.title.should.equal('B: Backup Key');
6565
qrData.backup.description.should.equal('This is your backup private key, encrypted with your wallet password.');
6666
qrData.backup.data.should.equal(backupEncryptedPrv);
6767

68-
assert(qrData.bitgo);
68+
assert.ok(qrData.bitgo);
6969
qrData.bitgo.title.should.equal('C: BitGo Public Key');
7070
qrData.bitgo.description.should.equal(
7171
'This is the public part of the key that BitGo will use to ' + 'co-sign transactions\r\nwith you on your wallet.'
7272
);
7373
qrData.bitgo.data.should.equal(bitgoPub);
7474

75-
assert(qrData.passcode);
75+
assert.ok(qrData.passcode);
7676
qrData.passcode.title.should.equal('D: Encrypted wallet Password');
7777
qrData.passcode.description.should.equal(
7878
'This is the wallet password, encrypted client-side with a key held by BitGo.'
@@ -123,13 +123,13 @@ describe('generateQrData', function () {
123123
qrData.user.data.should.equal(userPub);
124124
should.equal(qrData.user.publicMasterKey, userMasterKey);
125125

126-
assert(qrData.backup);
126+
assert.ok(qrData.backup);
127127
qrData.backup.title.should.equal('B: Provided Backup Key');
128128
qrData.backup.description.should.equal('This is the public key you provided for your wallet.');
129129
qrData.backup.data.should.equal(backupPub);
130130
should.equal(qrData.backup?.publicMasterKey, backupMasterKey);
131131

132-
assert(qrData.bitgo);
132+
assert.ok(qrData.bitgo);
133133
qrData.bitgo.data.should.equal(bitgoPub);
134134

135135
should.not.exist(qrData.passcode);
@@ -160,7 +160,7 @@ describe('generateQrData', function () {
160160

161161
qrData.user.data.should.equal(userEncryptedPrv);
162162

163-
assert(qrData.backup);
163+
assert.ok(qrData.backup);
164164
qrData.backup.title.should.equal('B: Backup Key');
165165
qrData.backup.description.should.equal(
166166
'This is the public key held at ' +
@@ -173,7 +173,7 @@ describe('generateQrData', function () {
173173
);
174174
qrData.backup.data.should.equal(backupPub);
175175

176-
assert(qrData.bitgo);
176+
assert.ok(qrData.bitgo);
177177
qrData.bitgo.data.should.equal(bitgoPub);
178178
});
179179
});

0 commit comments

Comments
 (0)