Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typecheck some tests in modules/bitgo/ #5187

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Here is a template to help get started:</br>
"outDir": "./dist",
"rootDir": "."
},
"include": ["src/**/*", "package.json"],
"include": ["src/**/*", "test/**/*", "package.json"],
"references": [
{
"path": "../sdk-core"
Expand Down
4 changes: 2 additions & 2 deletions modules/bitgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"webpack-dev": "cross-env NODE_ENV=development webpack",
"webpack-prod": "NODE_OPTIONS=--max-old-space-size=4096 cross-env NODE_ENV=production webpack",
"test": "npm run coverage",
"unit-test": "mocha 'test/v2/unit/**/*.ts' 'test/unit/**/*.ts'",
"unit-test": "mocha 'test/legacy/v2/unit/**/*.ts' 'test/legacy/unit/**/*.ts' 'test/utxo/**/*.ts'",
"coverage": "nyc -- npm run unit-test",
"integration-test": "nyc -- mocha \"test/v2/integration/**/*.ts\"",
"integration-test": "nyc -- mocha \"test/legacy/v2/integration/**/*.ts\"",
"browser-test": "karma start karma.conf.js",
"lint": "eslint --quiet .",
"audit": "if [ \"$(npm --version | cut -d. -f1)\" -ge \"6\" ]; then npm audit; else echo \"npm >= 6 required to perform audit. skipping...\"; fi",
Expand Down
7 changes: 7 additions & 0 deletions modules/bitgo/test/legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `test/legacy`

These tests were historically excluded from typecheck, so some of the tests here are broken.

Consider moving them outside of `test/legacy` and fixing them.

Avoid adding new tests here.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as utxolib from '@bitgo/utxo-lib';
import { getSharedSecret, signMessageWithDerivedEcdhKey, verifyEcdhSignature } from '@bitgo/sdk-core';
import { TestBitGo } from '@bitgo/sdk-test';
import * as assert from 'assert';
import { BitGo } from '../src/bitgo';
import { BitGo } from '../../src/bitgo';

describe('ECDH utils', () => {
function getKey(seed: string) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { strict as assert } from 'assert';
import 'should';

const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');
const TestBitGo = require('../lib/test_bitgo');

const TEST_ADDRESS1 = '2N4Xz4itCdKKUREiySS7oBzoXUKnuxP4nRD';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script>
mocha.setup('bdd');
</script>
<script src="../browser/tests.js"></script>
<script src="../legacy/browser/tests.js"></script>
<script>
mocha.run();
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { strict as assert } from 'assert';
import 'should';
const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');

describe('Market', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { strict as assert } from 'assert';
import 'should';
import * as utxolib from '@bitgo/utxo-lib';

const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');
const TestBitGo = require('../lib/test_bitgo');
const TestUtil = require('./testutil');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'should';
import * as _ from 'lodash';
import { getSharedSecret } from '../../src/ecdh';

const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');
const bitcoin = BitGoJS.bitcoin;
const sjcl = require('@bitgo/sjcl');
const TestBitGo = require('../lib/test_bitgo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as utxolib from '@bitgo/utxo-lib';

const Q = require('q');

const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');
import { TestBitGo } from '../lib/test_bitgo';
const TransactionBuilder = require('../../src/transactionBuilder');
const crypto = require('crypto');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { strict as assert } from 'assert';
import 'should';
import * as _ from 'lodash';

const BitGoJS = require('../../src/index');
const BitGoJS = require('../../../src');
const TestBitGo = require('../lib/test_bitgo');

describe('Webhooks', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import assert = require('assert');
import { common, generateGPGKeyPair } from '@bitgo/sdk-core';
import { bip32, ECPair } from '@bitgo/utxo-lib';
import * as _ from 'lodash';
import * as BitGoJS from '../../src/index';
import * as BitGoJS from '../../../src';
const rp = require('request-promise');

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../src/bitgo';
import { BitGo } from '../../../src/bitgo';

nock.disableNetConnect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'should';
import { common } from '@bitgo/sdk-core';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../src/bitgo';
import { BitGo } from '../../../src/bitgo';

describe('Keychains', function v2keychains() {
describe('Update Password', function updatePassword() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'should';
import * as BitGoJS from '../../src';
import * as BitGoJS from '../../../src';

describe('legacyBitcoin', function () {
it('toBase58Check, fromBase58Check', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
//

import 'should';
import * as BitGoJS from '../../src';
import * as BitGoJS from '../../../src';
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../src/bitgo';
import { BitGo } from '../../../src/bitgo';

describe('Constructor', function () {
it('arguments', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { strict as assert } from 'assert';

import * as BitGoJS from '../../../src/index';
import * as BitGoJS from '../../../../src';
import { TestBitGo } from '../../lib/test_bitgo';

const TestUtil = require('../../integration/testutil');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'should';

import * as Bluebird from 'bluebird';
import { BaseCoin } from '../../../../src/v2';
import { BaseCoin } from '../../../../../src/v2';
const co = Bluebird.coroutine;

import { TestBitGo } from '../../../lib/test_bitgo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import 'should';
import { coroutine as co } from 'bluebird';
const BitGoJS = require('../../../src/index');
const BitGoJS = require('../../../../src');

describe('Market', function () {
// We start with supported coins, then add 't' to the front of each to get testnet coins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import * as nock from 'nock';
import { common, Wallet } from '@bitgo/sdk-core';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
const algoFixtures = require('../../../../sdk-coin-algo/test/fixtures/algo');
import { BitGo } from '../../../../src/bitgo';
// eslint-disable-next-line import/no-internal-modules
const algoFixtures = require('@bitgo/sdk-coin-algo/dist/test/fixtures/algo');

nock.disableNetConnect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as nock from 'nock';
import 'should';
import * as sinon from 'sinon';

import { BitGo } from '../../../src';
import { BitGo } from '../../../../src';

describe('Auth', () => {
describe('Auth V3', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'should';
import * as nock from 'nock';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';
import { Erc20Token } from '@bitgo/sdk-coin-eth';
import { StellarToken } from '@bitgo/sdk-coin-xlm';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as _ from 'lodash';
import * as should from 'should';
import { bip32 } from '@bitgo/utxo-lib';
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';
import { getBuilder, Eth } from '@bitgo/account-lib';
import * as ethAbi from 'ethereumjs-abi';
import * as ethUtil from 'ethereumjs-util';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as should from 'should';
import * as sinon from 'sinon';
import { UnexpectedAddressError, VerificationOptions } from '@bitgo/sdk-core';
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';
import {
AbstractUtxoCoin,
AbstractUtxoCoinWallet,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'should';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

describe('OFC:', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'should';
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

const PRECISION_2 = '100';
const PRECISION_6 = '1000000';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'should';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

describe('Stellar Token:', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'should';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

describe('SUSD:', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'should';
import { BaseCoin } from '@bitgo/sdk-core';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

describe('Virtual Token:', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'should';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src/bitgo';
import { BitGo } from '../../../../../src/bitgo';

describe('TSUSD:', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestBitGo } from '@bitgo/sdk-test';
import { common, Wallet, encodeLnurl, parseLightningInvoice } from '@bitgo/sdk-core';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';
import * as nock from 'nock';
import * as assert from 'assert';
import * as sinon from 'sinon';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as sinon from 'sinon';
import { common, ECDSAUtils, Enterprise } from '@bitgo/sdk-core';

import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';
import { mockChallengeA } from './internal/tssUtils/mocks/ecdsaNtilde';
import { bip32 } from '@bitgo/utxo-lib';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';
import { AliasEnvironments } from '@bitgo/sdk-core';

describe('Environments', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as should from 'should';
import * as openpgp from 'openpgp';

import { TestableBG, TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../src';
import { BitGo } from '../../../../../src';
import { BlsUtils, common, IBlsKeyPair, Keychain } from '@bitgo/sdk-core';
import assert = require('assert');
import { Eth2 } from '@bitgo/sdk-coin-eth2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@bitgo/sdk-core';
import { TestBitGo } from '@bitgo/sdk-test';

import { BitGo } from '../../../../../src';
import { BitGo } from '../../../../../../src';
import * as openpgp from 'openpgp';
import nock = require('nock');
import assert = require('assert');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TestableBG,
TestBitGo,
} from '@bitgo/sdk-test';
import { BitGo, createSharedDataProof, TssUtils, RequestType } from '../../../../../src';
import { BitGo, createSharedDataProof, TssUtils, RequestType } from '../../../../../../src';
import {
BackupGpgKey,
BackupKeyShare,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
WalletTypeEnum,
} from '@bitgo/public-types';
import { NonEmptyString } from 'io-ts-types';
import { BitGo, BitgoGPGPublicKey } from '../../../../../../src';
import { BitGo, BitgoGPGPublicKey } from '../../../../../../../src';
import * as v1Fixtures from './fixtures/mpcv1KeyShares';

describe('TSS Ecdsa MPCv2 Utils:', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import * as openpgp from 'openpgp';
import * as nock from 'nock';
import { TestableBG, TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../../../src';
import { BitGo } from '../../../../../../../src';
const createKeccakHash = require('keccak');

interface SignatureShareApiBody {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as should from 'should';
import * as sinon from 'sinon';

import { TestableBG, TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../../../src/bitgo';
import { BitGo } from '../../../../../../src/bitgo';
import {
common,
Keychain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
OvcShare,
} from '@bitgo/sdk-core';
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';

describe('V2 Keychains', function () {
let bitgo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TestBitGo } from '@bitgo/sdk-test';
import * as nock from 'nock';
import { BaseCoin, getLightningAuthKeychains, getLightningKeychain } from '@bitgo/sdk-core';

import { BitGo, common, GenerateLightningWalletOptions, Wallet, Wallets } from '../../../../src';
import { BitGo, common, GenerateLightningWalletOptions, Wallet, Wallets } from '../../../../../src';

describe('Lightning wallets', function () {
const coinName = 'tlnbtc';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src/bitgo';
import { BitGo } from '../../../../src/bitgo';

import * as nock from 'nock';
import { bip32 } from '@bitgo/utxo-lib';
import { common, TransactionType } from '@bitgo/sdk-core';
import { AvaxC as AvaxCAccountLib, getBuilder } from '../../../../account-lib';
import { AvaxC as AvaxCAccountLib, getBuilder } from '@bitgo/account-lib';

nock.enableNetConnect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'should';
import * as nock from 'nock';
import * as sinon from 'sinon';
import { TestableBG, TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src';
import { BitGo } from '../../../../src';

import {
BaseCoin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as should from 'should';
import * as nock from 'nock';

import { mockSerializedChallengeWithProofs, TestBitGo } from '@bitgo/sdk-test';
import { BitGo } from '../../../src';
import { BitGo } from '../../../../src';
import { krsProviders } from '@bitgo/sdk-core';
import { EcdsaRangeProof, EcdsaTypes } from '@bitgo/sdk-lib-mpc';
import { TransactionFactory } from '@ethereumjs/tx';
Expand Down
Loading