diff --git a/modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts b/modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts index 507b26fa8e..ccb7fe771e 100644 --- a/modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts +++ b/modules/bitgo/test/v2/unit/coins/utxo/recovery/mock.ts @@ -10,8 +10,10 @@ import { Bsv } from '@bitgo/sdk-coin-bsv'; type Unspent = bitgo.Unspent; export class MockRecoveryProvider implements RecoveryProvider { + public unspents: Unspent[]; private prevTxCache: Record = {}; - constructor(public unspents: Unspent[]) { + constructor(unspents: Unspent[]) { + this.unspents = unspents; this.unspents.forEach((u) => { if (utxolib.bitgo.isUnspentWithPrevTx(u)) { const { txid } = bitgo.parseOutputId(u.id); diff --git a/modules/bitgo/test/v2/unit/staking/stakingWalletNonTSS.ts b/modules/bitgo/test/v2/unit/staking/stakingWalletNonTSS.ts index 72a5663560..44779f7f7d 100644 --- a/modules/bitgo/test/v2/unit/staking/stakingWalletNonTSS.ts +++ b/modules/bitgo/test/v2/unit/staking/stakingWalletNonTSS.ts @@ -242,7 +242,7 @@ describe('non-TSS Staking Wallet', function () { .reply(200, transaction); const prebuildTransaction = sandbox.stub(Wallet.prototype, 'prebuildTransaction'); - const descriptor = sandbox.stub(StakingWallet.prototype, 'getDescriptorWallet'); + const descriptor = sandbox.stub(StakingWallet.prototype, 'getDescriptorWallet' as any); await btcStakingWallet.build(transaction); prebuildTransaction.calledOnceWithExactly(transaction.buildParams).should.be.true; descriptor.notCalled.should.be.true; diff --git a/modules/blockapis/test/UtxoApi.ts b/modules/blockapis/test/UtxoApi.ts index fc3249728d..f00305f93e 100644 --- a/modules/blockapis/test/UtxoApi.ts +++ b/modules/blockapis/test/UtxoApi.ts @@ -43,12 +43,19 @@ type MethodArguments = unknown[]; * A test case for a UtxoApi method. */ class TestCase { + public coinName: string; + public methodName: keyof UtxoApi; + public args: unknown[]; /** * @param coinName - coin to test * @param methodName - method to test * @param args - method arguments */ - constructor(public coinName: string, public methodName: keyof UtxoApi, public args: unknown[]) {} + constructor(coinName: string, methodName: keyof UtxoApi, args: unknown[]) { + this.coinName = coinName; + this.methodName = methodName; + this.args = args; + } /** * Call the method on the given API. diff --git a/modules/sdk-coin-eos/test/unit/eos.ts b/modules/sdk-coin-eos/test/unit/eos.ts index 0b2bd7525f..a72f611d8f 100644 --- a/modules/sdk-coin-eos/test/unit/eos.ts +++ b/modules/sdk-coin-eos/test/unit/eos.ts @@ -126,7 +126,7 @@ describe('EOS:', function () { // mock responses to the block chain const sandBox = sinon.createSandbox(); - const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode'); + const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode' as any); callBack .withArgs({ endpoint: '/v1/chain/get_account', @@ -380,7 +380,7 @@ describe('EOS:', function () { beforeEach(async () => { // mock responses to the block chain sandBox = sinon.createSandbox(); - const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode'); + const callBack = sandBox.stub(Eos.prototype, 'getDataFromNode' as any); callBack .withArgs({ endpoint: '/v1/chain/get_info', diff --git a/modules/sdk-coin-sui/test/local_fullnode/RpcClient.ts b/modules/sdk-coin-sui/test/local_fullnode/RpcClient.ts index f82a71cf17..f50b418e69 100644 --- a/modules/sdk-coin-sui/test/local_fullnode/RpcClient.ts +++ b/modules/sdk-coin-sui/test/local_fullnode/RpcClient.ts @@ -24,8 +24,11 @@ function unwrapResult(method: string, v: { result: A } | { error: { code: num } export class RpcError extends Error { - constructor(public rpcError: { code: number; message: string }) { + public rpcError: { code: number; message: string }; + + constructor(rpcError: { code: number; message: string }) { super(`RPC error: ${rpcError.message} (code=${rpcError.code})`); + this.rpcError = rpcError; } static isRpcErrorWithCode(e: Error, code: number): boolean { @@ -44,10 +47,13 @@ export type Coin = { /** Wrapper around https://docs.sui.io/sui-jsonrpc */ export class RpcClient { + public url: string; // Running counter, increments every request id = 0; - constructor(public url: string) {} + constructor(url: string) { + this.url = url; + } static async createCheckedConnection(url: string): Promise { const rpcClient = new RpcClient(url); diff --git a/modules/sdk-coin-sui/test/local_fullnode/faucet.ts b/modules/sdk-coin-sui/test/local_fullnode/faucet.ts index fa13c21c40..691d226fbf 100644 --- a/modules/sdk-coin-sui/test/local_fullnode/faucet.ts +++ b/modules/sdk-coin-sui/test/local_fullnode/faucet.ts @@ -1,7 +1,10 @@ import axios from 'axios'; export class Faucet { - constructor(public url: string) {} + public url: string; + constructor(url: string) { + this.url = url; + } async getCoins(address: string, amount: number): Promise { await axios.post(this.url + '/gas', { FixedAmountRequest: { recipient: address } }); diff --git a/modules/unspents/test/signedTx/txGen.ts b/modules/unspents/test/signedTx/txGen.ts index 5836105fff..ca0d30be9b 100644 --- a/modules/unspents/test/signedTx/txGen.ts +++ b/modules/unspents/test/signedTx/txGen.ts @@ -105,17 +105,29 @@ function signInput( } class TxCombo { + public walletKeys: BIP32Interface[]; + public inputTypes: string[]; + public outputTypes: TestUnspentType[]; + public expectedDims: Readonly; + public signKeys?: BIP32Interface[]; + public inputValue: number; public unspents: IUnspent[]; public inputTx: any; constructor( - public walletKeys: BIP32Interface[], - public inputTypes: string[], - public outputTypes: TestUnspentType[], - public expectedDims: Readonly = Dimensions.ZERO, - public signKeys?: BIP32Interface[], - public inputValue: number = 10 + walletKeys: BIP32Interface[], + inputTypes: string[], + outputTypes: TestUnspentType[], + expectedDims: Readonly = Dimensions.ZERO, + signKeys?: BIP32Interface[], + inputValue = 10 ) { + this.walletKeys = walletKeys; + this.inputTypes = inputTypes; + this.outputTypes = outputTypes; + this.expectedDims = expectedDims; + this.signKeys = signKeys; + this.inputValue = inputValue; this.unspents = inputTypes.map((inputType) => createUnspent( walletKeys.map((key) => key.publicKey), @@ -180,9 +192,12 @@ const runCombinations = ( }; class Histogram { + public map: Map; public total = 0; - constructor(public map: Map = new Map()) {} + constructor(map: Map = new Map()) { + this.map = map; + } public add(size: number): void { this.map.set(size, (this.map.get(size) || 0) + 1); diff --git a/modules/unspents/test/testutils.ts b/modules/unspents/test/testutils.ts index d1afb03109..ee432b472a 100644 --- a/modules/unspents/test/testutils.ts +++ b/modules/unspents/test/testutils.ts @@ -31,7 +31,10 @@ export const UnspentTypePubKeyHash: { export type TestUnspentType = string | UnspentTypeOpReturn; export class UnspentTypeOpReturn { - constructor(public size: number) {} + public size: number; + constructor(size: number) { + this.size = size; + } public toString(): string { return `opReturn(${this.size})`;