Skip to content

Commit 364185e

Browse files
authored
Merge pull request #6527 from BitGo/CAAS-325-tests
chore: update test for node 24
2 parents 6875dc9 + 1f2fc83 commit 364185e

File tree

8 files changed

+52
-16
lines changed

8 files changed

+52
-16
lines changed

modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import { Bsv } from '@bitgo/sdk-coin-bsv';
1010

1111
type Unspent<TNumber extends number | bigint = number> = bitgo.Unspent<TNumber>;
1212
export class MockRecoveryProvider implements RecoveryProvider {
13+
public unspents: Unspent<bigint>[];
1314
private prevTxCache: Record<string, string> = {};
14-
constructor(public unspents: Unspent<bigint>[]) {
15+
constructor(unspents: Unspent<bigint>[]) {
16+
this.unspents = unspents;
1517
this.unspents.forEach((u) => {
1618
if (utxolib.bitgo.isUnspentWithPrevTx(u)) {
1719
const { txid } = bitgo.parseOutputId(u.id);

modules/bitgo/test/v2/unit/staking/stakingWalletNonTSS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ describe('non-TSS Staking Wallet', function () {
242242
.reply(200, transaction);
243243

244244
const prebuildTransaction = sandbox.stub(Wallet.prototype, 'prebuildTransaction');
245-
const descriptor = sandbox.stub(StakingWallet.prototype, <any>'getDescriptorWallet');
245+
const descriptor = sandbox.stub(StakingWallet.prototype, 'getDescriptorWallet' as any);
246246
await btcStakingWallet.build(transaction);
247247
prebuildTransaction.calledOnceWithExactly(transaction.buildParams).should.be.true;
248248
descriptor.notCalled.should.be.true;

modules/blockapis/test/UtxoApi.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ type MethodArguments = unknown[];
4343
* A test case for a UtxoApi method.
4444
*/
4545
class TestCase<T> {
46+
public coinName: string;
47+
public methodName: keyof UtxoApi;
48+
public args: unknown[];
4649
/**
4750
* @param coinName - coin to test
4851
* @param methodName - method to test
4952
* @param args - method arguments
5053
*/
51-
constructor(public coinName: string, public methodName: keyof UtxoApi, public args: unknown[]) {}
54+
constructor(coinName: string, methodName: keyof UtxoApi, args: unknown[]) {
55+
this.coinName = coinName;
56+
this.methodName = methodName;
57+
this.args = args;
58+
}
5259

5360
/**
5461
* Call the method on the given API.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('EOS:', function () {
126126

127127
// mock responses to the block chain
128128
const sandBox = sinon.createSandbox();
129-
const callBack = sandBox.stub(Eos.prototype, <any>'getDataFromNode');
129+
const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode' as any);
130130
callBack
131131
.withArgs({
132132
endpoint: '/v1/chain/get_account',
@@ -380,7 +380,7 @@ describe('EOS:', function () {
380380
beforeEach(async () => {
381381
// mock responses to the block chain
382382
sandBox = sinon.createSandbox();
383-
const callBack = sandBox.stub(Eos.prototype, <any>'getDataFromNode');
383+
const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode' as any);
384384
callBack
385385
.withArgs({
386386
endpoint: '/v1/chain/get_info',

modules/sdk-coin-sui/test/local_fullnode/RpcClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ function unwrapResult<A>(method: string, v: { result: A } | { error: { code: num
2424
}
2525

2626
export class RpcError extends Error {
27-
constructor(public rpcError: { code: number; message: string }) {
27+
public rpcError: { code: number; message: string };
28+
29+
constructor(rpcError: { code: number; message: string }) {
2830
super(`RPC error: ${rpcError.message} (code=${rpcError.code})`);
31+
this.rpcError = rpcError;
2932
}
3033

3134
static isRpcErrorWithCode(e: Error, code: number): boolean {
@@ -44,10 +47,13 @@ export type Coin = {
4447

4548
/** Wrapper around https://docs.sui.io/sui-jsonrpc */
4649
export class RpcClient {
50+
public url: string;
4751
// Running counter, increments every request
4852
id = 0;
4953

50-
constructor(public url: string) {}
54+
constructor(url: string) {
55+
this.url = url;
56+
}
5157

5258
static async createCheckedConnection(url: string): Promise<RpcClient> {
5359
const rpcClient = new RpcClient(url);

modules/sdk-coin-sui/test/local_fullnode/faucet.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import axios from 'axios';
22

33
export class Faucet {
4-
constructor(public url: string) {}
4+
public url: string;
5+
constructor(url: string) {
6+
this.url = url;
7+
}
58

69
async getCoins(address: string, amount: number): Promise<void> {
710
await axios.post(this.url + '/gas', { FixedAmountRequest: { recipient: address } });

modules/unspents/test/signedTx/txGen.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,29 @@ function signInput(
105105
}
106106

107107
class TxCombo {
108+
public walletKeys: BIP32Interface[];
109+
public inputTypes: string[];
110+
public outputTypes: TestUnspentType[];
111+
public expectedDims: Readonly<Dimensions>;
112+
public signKeys?: BIP32Interface[];
113+
public inputValue: number;
108114
public unspents: IUnspent[];
109115
public inputTx: any;
110116

111117
constructor(
112-
public walletKeys: BIP32Interface[],
113-
public inputTypes: string[],
114-
public outputTypes: TestUnspentType[],
115-
public expectedDims: Readonly<Dimensions> = Dimensions.ZERO,
116-
public signKeys?: BIP32Interface[],
117-
public inputValue: number = 10
118+
walletKeys: BIP32Interface[],
119+
inputTypes: string[],
120+
outputTypes: TestUnspentType[],
121+
expectedDims: Readonly<Dimensions> = Dimensions.ZERO,
122+
signKeys?: BIP32Interface[],
123+
inputValue = 10
118124
) {
125+
this.walletKeys = walletKeys;
126+
this.inputTypes = inputTypes;
127+
this.outputTypes = outputTypes;
128+
this.expectedDims = expectedDims;
129+
this.signKeys = signKeys;
130+
this.inputValue = inputValue;
119131
this.unspents = inputTypes.map((inputType) =>
120132
createUnspent(
121133
walletKeys.map((key) => key.publicKey),
@@ -180,9 +192,12 @@ const runCombinations = (
180192
};
181193

182194
class Histogram {
195+
public map: Map<number, number>;
183196
public total = 0;
184197

185-
constructor(public map: Map<number, number> = new Map()) {}
198+
constructor(map: Map<number, number> = new Map()) {
199+
this.map = map;
200+
}
186201

187202
public add(size: number): void {
188203
this.map.set(size, (this.map.get(size) || 0) + 1);

modules/unspents/test/testutils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ export const UnspentTypePubKeyHash: {
3131
export type TestUnspentType = string | UnspentTypeOpReturn;
3232

3333
export class UnspentTypeOpReturn {
34-
constructor(public size: number) {}
34+
public size: number;
35+
constructor(size: number) {
36+
this.size = size;
37+
}
3538

3639
public toString(): string {
3740
return `opReturn(${this.size})`;

0 commit comments

Comments
 (0)