From 63d2478dd04fb1287232a59225cb11fe567e3dcd Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 11 Sep 2018 14:45:50 +0100 Subject: [PATCH] Fix embark test using node option --- .../test/simple_storage_deploy_spec.js | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/test_apps/test_app/test/simple_storage_deploy_spec.js b/test_apps/test_app/test/simple_storage_deploy_spec.js index b81c8178e..657844d69 100644 --- a/test_apps/test_app/test/simple_storage_deploy_spec.js +++ b/test_apps/test_app/test/simple_storage_deploy_spec.js @@ -1,22 +1,34 @@ -/*global contract, it, embark, assert, before*/ +/*global contract, it, embark, assert, before, web3*/ const SimpleStorage = embark.require('Embark/contracts/SimpleStorage'); +const Utils = require('embarkjs').Utils; contract("SimpleStorage Deploy", function () { - let SimpleStorageInstance; - - before(async function() { - SimpleStorageInstance = await SimpleStorage.deploy({arguments: [150]}).send(); + let simpleStorageInstance; + before(function(done) { + Utils.secureSend(web3, SimpleStorage.deploy({arguments: [150]}), {}, true, function(err, receipt) { + if(err) { + return done(err); + } + simpleStorageInstance = SimpleStorage; + simpleStorageInstance.options.address = receipt.contractAddress; + done(); + }); }); it("should set constructor value", async function () { - let result = await SimpleStorageInstance.methods.storedData().call(); + let result = await simpleStorageInstance.methods.storedData().call(); assert.strictEqual(parseInt(result, 10), 150); }); - it("set storage value", async function () { - await SimpleStorageInstance.methods.set(150).send(); - let result = await SimpleStorageInstance.methods.get().call(); - assert.strictEqual(parseInt(result, 10), 150); + it("set storage value", function (done) { + Utils.secureSend(web3, simpleStorageInstance.methods.set(200), {}, false, async function(err) { + if (err) { + return done(err); + } + let result = await simpleStorageInstance.methods.get().call(); + assert.strictEqual(parseInt(result, 10), 200); + done(); + }); }); });