From 48e187b073e7785c266ef5a50bbd41cb91cf795f Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Wed, 24 Jun 2020 00:27:07 -0700 Subject: [PATCH] Fix all tests --- test/account.test.js | 6 +++--- test/test-utils.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/account.test.js b/test/account.test.js index c9ed64d1ff..d8e7981531 100644 --- a/test/account.test.js +++ b/test/account.test.js @@ -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; @@ -65,7 +65,7 @@ describe('errors', () => { beforeEach(async () => { oldLog = console.log; - logs =[]; + logs = []; console.log = function () { logs.push(Array.from(arguments).join(' ')); }; @@ -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'] diff --git a/test/test-utils.js b/test/test-utils.js index f927e2cde5..e77effff55 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -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'] }); } @@ -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, +};