Skip to content

Commit

Permalink
test: fix accounts tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-haynes committed Mar 7, 2023
1 parent 58064e9 commit 5960b51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion 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 getConfig from './config.js';
import testUtils from './test-utils.js';

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.js';

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 5960b51

Please sign in to comment.