Updated test unit to reflect changes in recovery contract

This commit is contained in:
Richard Ramos 2018-03-13 19:30:12 -04:00
parent 7695b461fb
commit c9711c2250
2 changed files with 39 additions and 0 deletions

View File

@ -8,4 +8,27 @@ contract TestContract {
function test() public { function test() public {
TestFunctionExecuted(); 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)
external
pure
returns(bytes32)
{
return keccak256(identity, _revealedSecret, _dest, _data, _newSecret, _newFriendsHashes);
}
} }

View File

@ -103,6 +103,21 @@ const _setupRecovery = function(address){
}, [address]); }, [address]);
} }
const _managerReset = function(address){
if(!/^(0x)?[0-9a-f]{0,40}$/i.test(address))
throw new Error('Address "'+ address +'" is not a valid Ethereum address.');
return web3EthAbi.encodeFunctionCall({
name: 'managerReset',
type: 'function',
inputs: [{
type: 'address',
name: '_newKey'
}]
}, [address]);
}
const _updateUpdatableInstance = function(address){ const _updateUpdatableInstance = function(address){
if(!/^(0x)?[0-9a-f]{0,40}$/i.test(address)) if(!/^(0x)?[0-9a-f]{0,40}$/i.test(address))
throw new Error('Address "'+ address +'" is not a valid Ethereum address.'); throw new Error('Address "'+ address +'" is not a valid Ethereum address.');
@ -167,6 +182,7 @@ module.exports = {
removeKey: _removeKey, removeKey: _removeKey,
setMinimumApprovalsByKeyType: _setMinimumApprovalsByKeyType, setMinimumApprovalsByKeyType: _setMinimumApprovalsByKeyType,
setupRecovery: _setupRecovery, setupRecovery: _setupRecovery,
managerReset: _managerReset,
updateUpdatableInstance: _updateUpdatableInstance, updateUpdatableInstance: _updateUpdatableInstance,
updateRequestUpdatableInstance: _updateRequestUpdatableInstance, updateRequestUpdatableInstance: _updateRequestUpdatableInstance,
updateConfirmUpdatableInstance: _updateConfirmUpdatableInstance, updateConfirmUpdatableInstance: _updateConfirmUpdatableInstance,