Skip to content

Commit

Permalink
Fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Jun 24, 2020
1 parent d160abc commit 48e187b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let nearjs;
let workingAccount;
let startFromVersion;

const HELLO_WASM_PATH = process.env.HELLO_WASM_PATH || 'node_modules/near-hello/dist/main.wasm';
const { HELLO_WASM_PATH, HELLO_WASM_BALANCE } = testUtils;

jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;

Expand Down Expand Up @@ -65,7 +65,7 @@ describe('errors', () => {

beforeEach(async () => {
oldLog = console.log;
logs =[];
logs = [];
console.log = function () {
logs.push(Array.from(arguments).join(' '));
};
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('with deploy contract', () => {
beforeAll(async () => {
const newPublicKey = await nearjs.connection.signer.createKey(contractId, testUtils.networkId);
const data = [...fs.readFileSync(HELLO_WASM_PATH)];
await workingAccount.createAndDeployContract(contractId, newPublicKey, data);
await workingAccount.createAndDeployContract(contractId, newPublicKey, data, HELLO_WASM_BALANCE);
contract = new nearApi.Contract(workingAccount, contractId, {
viewMethods: ['hello', 'getValue', 'returnHiWithLogs'],
changeMethods: ['setValue', 'generateLogs', 'triggerAssert', 'testSetRemove', 'crossContract']
Expand Down
14 changes: 12 additions & 2 deletions test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function deployContract(workingAccount, contractId) {
await workingAccount.createAndDeployContract(contractId, newPublicKey, data, HELLO_WASM_BALANCE);
return new nearApi.Contract(workingAccount, contractId, {
viewMethods: ['getValue', 'getLastResult'],
changeMethods: ['setValue', 'callPromise']
});
}

Expand All @@ -60,5 +61,14 @@ async function ensureDir(dirpath) {
}
}

module.exports = { setUpTestConnection, networkId,
generateUniqueString, createAccount, deployContract, sleep, ensureDir };
module.exports = {
setUpTestConnection,
networkId,
generateUniqueString,
createAccount,
deployContract,
sleep,
ensureDir,
HELLO_WASM_PATH,
HELLO_WASM_BALANCE,
};

0 comments on commit 48e187b

Please sign in to comment.