Skip to content

Commit 12ba9f6

Browse files
fix(bitgo): update imports and assertions for Node 22 compatibility
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> TICKET: WP-5599
1 parent 0efe1d0 commit 12ba9f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+132
-132
lines changed

modules/bitgo/test/ecdh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('ECDH utils', () => {
2121
const eckey1 = getKey(`${i}.a`);
2222
const eckey2 = getKey(`${i}.b`);
2323

24-
assert(eckey1.privateKey);
24+
assert.ok(eckey1.privateKey);
2525
[eckey1, utxolib.bitgo.keyutil.privateKeyBufferToECPair(eckey1.privateKey)].forEach((privateKey) => {
2626
const sharingKey1 = getSharedSecret(privateKey, eckey2).toString('hex');
2727
const sharingKey2 = getSharedSecret(eckey2, eckey1).toString('hex');

modules/bitgo/test/encrypt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @prettier
33
*/
4-
import * as should from 'should';
4+
import should = require('should');
55

66
import { randomBytes } from 'crypto';
77
import { decrypt, encrypt, bytesToWord } from '@bitgo/sdk-api';

modules/bitgo/test/integration/accesstoken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* eslint-disable @typescript-eslint/no-empty-function */
88

99
import { strict as assert } from 'assert';
10-
import * as should from 'should';
10+
import should = require('should');
1111
import * as _ from 'lodash';
1212

1313
const TestBitGo = require('../lib/test_bitgo');

modules/bitgo/test/integration/blockchain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ describe('Address', function () {
8686
assert.equal(result.start, 0);
8787
result.should.have.property('total');
8888
result.should.have.property('count');
89-
assert(result.transactions.length > 20);
89+
assert.ok(result.transactions.length > 20);
9090
assert.equal(result.transactions.length, result.count);
91-
assert(result.total > 75);
91+
assert.ok(result.total > 75);
9292
done();
9393
});
9494
});

modules/bitgo/test/integration/testutil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
const TestUtil = module.exports;
6-
import * as should from 'should';
6+
import should = require('should');
77
import * as _ from 'lodash';
88
const Q = require('q');
99

modules/bitgo/test/integration/travelRule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ describe('Travel Rule API', function () {
213213
return travel
214214
.sendMany({ txid: txid, travelInfos: travelInfos })
215215
.then(function () {
216-
assert(false); // should not get here
216+
assert.ok(false); // should not get here
217217
})
218218
.catch(function (err) {
219219
err.message.should.equal('amount did not match for output index 0');

modules/bitgo/test/integration/wallet.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* eslint-disable @typescript-eslint/no-empty-function */
88

99
import { strict as assert } from 'assert';
10-
import * as should from 'should';
10+
import should = require('should');
1111
import { VirtualSizes } from '@bitgo/unspents';
1212
import * as utxolib from '@bitgo/utxo-lib';
1313

@@ -1044,7 +1044,7 @@ describe('Wallet API', function () {
10441044
progressDetails.should.have.property('index');
10451045
progressDetails.should.have.property('inputCount');
10461046
progressDetails.index.should.equal(progressCallbackCount);
1047-
assert(progressDetails.inputCount <= maxInputCountPerConsolidation);
1047+
assert.ok(progressDetails.inputCount <= maxInputCountPerConsolidation);
10481048
progressCallbackCount++;
10491049
};
10501050

@@ -2445,7 +2445,7 @@ describe('Wallet API', function () {
24452445
walletPassphrase: TestBitGo.TEST_WALLET1_PASSCODE,
24462446
})
24472447
.then(function (res) {
2448-
assert(false); // should not reach
2448+
assert.ok(false); // should not reach
24492449
})
24502450
.catch(function (err) {
24512451
err.message.should.eql('Insufficient funds');
@@ -2466,7 +2466,7 @@ describe('Wallet API', function () {
24662466
instant: true,
24672467
})
24682468
.then(function (res) {
2469-
assert(false); // should not reach
2469+
assert.ok(false); // should not reach
24702470
})
24712471
.catch(function (err) {
24722472
err.message.should.eql('wallet does not support instant transactions');
@@ -2486,7 +2486,7 @@ describe('Wallet API', function () {
24862486
});
24872487
})
24882488
.then(function (result) {
2489-
assert(false); // should not reach
2489+
assert.ok(false); // should not reach
24902490
})
24912491
.catch(function (err) {
24922492
err.needsOTP.should.equal(true);
@@ -3037,7 +3037,7 @@ describe('Wallet API', function () {
30373037
.createTransaction({ recipients: recipients })
30383038
.then(function (result) {
30393039
// should not reach
3040-
assert(false);
3040+
assert.ok(false);
30413041
})
30423042
.catch(function (err) {
30433043
err.message.should.containEql('incorrect type for field fromUserName in travel info');

modules/bitgo/test/integration/wallets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const TestBitGo = require('../lib/test_bitgo');
1414
import * as utxolib from '@bitgo/utxo-lib';
1515
import { getAddressP2PKH, getNetwork } from '../../src/bitcoin';
1616
import { common } from '@bitgo/sdk-core';
17-
import * as nock from 'nock';
17+
import nock = require('nock');
1818

1919
const TEST_WALLET_LABEL = 'wallet management test';
2020

@@ -171,7 +171,7 @@ describe('Wallets', function () {
171171
assert.equal(keychain.xpub, keychains[1].xpub);
172172

173173
bitgo.keychains().createBitGo({}, function (err, keychain) {
174-
assert(keychain.xpub);
174+
assert.ok(keychain.xpub);
175175
keychains.push(keychain);
176176

177177
const options = {
@@ -362,7 +362,7 @@ describe('Wallets', function () {
362362
id: newKey.address.toString(),
363363
};
364364
wallets.get(options, function (err, wallet) {
365-
assert(!wallet);
365+
assert.ok(!wallet);
366366
done();
367367
});
368368
});

modules/bitgo/test/unit/bitgo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//
44

55
import * as crypto from 'crypto';
6-
import * as nock from 'nock';
7-
import * as should from 'should';
6+
import nock = require('nock');
7+
import should = require('should');
88
import assert = require('assert');
99

1010
import { common, generateGPGKeyPair } from '@bitgo/sdk-core';
@@ -707,7 +707,7 @@ describe('BitGo Prototype Methods', function () {
707707
nock('https://bitgo.fakeurl')
708708
.post('/api/auth/v1/session')
709709
.reply(200, async (uri, requestBody) => {
710-
assert(typeof requestBody === 'object');
710+
assert.ok(typeof requestBody === 'object');
711711
should.exist(requestBody.userId);
712712
should.exist(requestBody.passkey);
713713
requestBody.userId.should.equal(userId);
@@ -752,7 +752,7 @@ describe('BitGo Prototype Methods', function () {
752752
assert.fail('Expected error not thrown');
753753
} catch (e) {
754754
console.log(e);
755-
assert(e.message.includes('JSON'));
755+
assert.ok(e.message.includes('JSON'));
756756
}
757757
});
758758
it('should throw - missing access token', async () => {

modules/bitgo/test/unit/keychains.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//
44

55
import * as _ from 'lodash';
6-
import * as nock from 'nock';
76
import 'should';
7+
import nock = require('nock');
88

99
import { common } from '@bitgo/sdk-core';
1010

0 commit comments

Comments
 (0)