Skip to content

Commit

Permalink
test: fix account tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-haynes committed Mar 3, 2023
1 parent ee06115 commit 554855d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/accounts/test/account_multisig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fs from 'fs';
import semver from 'semver';

import { Account2FA, MULTISIG_DEPOSIT, MULTISIG_GAS } from '../lib/esm';
import testUtils from './test-utils.js';
import testUtils from './test-utils';

const { functionCall, transfer } = actionCreators;

Expand Down
6 changes: 4 additions & 2 deletions packages/accounts/test/providers.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { jest } from '@jest/globals';
import { JsonRpcProvider } from '@near-js/providers';
import BN from 'bn.js';
import base58 from 'bs58';

import testUtils from './test-utils.js';
import getConfig from './config';
import testUtils from './test-utils';

jest.setTimeout(20000);

const withProvider = (fn) => {
const config = Object.assign(require('./config')(process.env.NODE_ENV || 'test'));
const config = Object.assign(getConfig(process.env.NODE_ENV || 'test'));
const provider = new JsonRpcProvider(config.nodeUrl);
return () => fn(provider);
};
Expand Down
5 changes: 3 additions & 2 deletions packages/accounts/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BN from 'bn.js';
import { promises as fs } from 'fs';

import { Account, AccountMultisig, Contract, Connection, LocalAccountCreator } from '../lib/esm';
import getConfig from './config';

const networkId = 'unittest';

Expand All @@ -20,7 +21,7 @@ const RANDOM_ACCOUNT_LENGTH = 40;

async function setUpTestConnection() {
const keyStore = new InMemoryKeyStore();
const config = Object.assign(require('./config')(process.env.NODE_ENV || 'test'), {
const config = Object.assign(getConfig(process.env.NODE_ENV || 'test'), {
networkId,
keyStore
});
Expand Down Expand Up @@ -112,7 +113,7 @@ function waitFor(fn) {
return _waitFor();
}

module.exports = {
export default {
setUpTestConnection,
networkId,
generateUniqueString,
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-account/test/wallet_account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { baseDecode, deserialize } from 'borsh';
import localStorage from 'localstorage-memory';
import url from 'url';

import { WalletConnection } from '../lib/wallet_account';
import { WalletConnection } from '../lib/esm';

const { functionCall, transfer } = actionCreators;

Expand Down

0 comments on commit 554855d

Please sign in to comment.