From 7235aa85d73a843ca8886327ee793b6ab6767430 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 15 Mar 2018 10:41:05 -0400 Subject: [PATCH] Updated friendsRecovery.js to work with embark --- contracts/tests/TestContract.sol | 22 ++++++++++++++++++++++ test/factory.js | 5 ++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/contracts/tests/TestContract.sol b/contracts/tests/TestContract.sol index 0ed094e..ab6ec58 100644 --- a/contracts/tests/TestContract.sol +++ b/contracts/tests/TestContract.sol @@ -8,4 +8,26 @@ contract TestContract { function test() public { TestFunctionExecuted(); } + + /* + Helper function to be used in unit testing due to error in web3 + web3.utils.soliditySha3([1, 2, 3]) + Error: Autodetection of array types is not supported. + at _processSoliditySha3Args (node_modules/web3-utils/src/soliditySha3.js:176:15) + */ + function hash( + address identity, + bytes32 _revealedSecret, + address _dest, + bytes _data, + bytes32 _newSecret, + bytes32[] _newFriendsHashes) + public + pure + returns(bytes32) + { + return keccak256(identity, _revealedSecret, _dest, _data, _newSecret, _newFriendsHashes); + + } + } \ No newline at end of file diff --git a/test/factory.js b/test/factory.js index 4f73118..4915c07 100644 --- a/test/factory.js +++ b/test/factory.js @@ -3,12 +3,11 @@ const Embark = require('embark'); let EmbarkSpec = Embark.initTests(); let web3 = EmbarkSpec.web3; -const identityJson = require('../build/contracts/Identity.json'); -const updatedIdentityKernelJson = require('../build/contracts/UpdatedIdentityKernel.json'); +const identityJson = require('../dist/contracts/Identity.json'); +const updatedIdentityKernelJson = require('../dist/contracts/UpdatedIdentityKernel.json'); const TestUtils = require("../utils/testUtils.js") const idUtils = require("../utils/identityUtils.js") -const web3EthAbi = require("web3-eth-abi"); describe('IdentityFactory', function(accounts) {