Skip to content

Commit

Permalink
Fixed eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gulshanvasnani committed Mar 28, 2019
1 parent 0582e90 commit c8d1551
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
16 changes: 8 additions & 8 deletions test/test_lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,16 @@ module.exports = {
const contract = artifacts.require(contractName);

let methodConcat = methodName.concat('(');
let input, abiMethod;
let input;
let abiMethod;

for(let i = 0; i < contract.abi.length; i++) {
for (let i = 0; i < contract.abi.length; i += 1) {
abiMethod = contract.abi[i];
if(abiMethod.name === methodName) {
for(let j=0; j < abiMethod.inputs.length - 1; j ++) {
if (abiMethod.name === methodName) {
for (let j = 0; j < abiMethod.inputs.length - 1; j += 1) {
input = abiMethod.inputs[j].type;
methodConcat = methodConcat.concat(input,',');
}
methodConcat = methodConcat.concat(input, ',');
}
input = abiMethod.inputs[abiMethod.inputs.length - 1].type;
methodConcat += input;
}
Expand All @@ -189,7 +190,6 @@ module.exports = {
const expectedPrefix = web3.utils.soliditySha3(methodConcat).substring(0, 10);

assert.strictEqual(expectedPrefix, callPrefix, `Expected ${methodName} callprefix is ${callPrefix} but got ${expectedPrefix}`);

},

getParamFromTxEvent: (
Expand Down Expand Up @@ -219,5 +219,5 @@ module.exports = {
assert(typeof param !== 'undefined');

return param;
}
},
};
12 changes: 6 additions & 6 deletions test/token_holder/execute_rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const Utils = require('../test_lib/utils.js');
const { TokenHolderUtils } = require('./utils.js');
const { Event } = require('../test_lib/event_decoder');
const { AccountProvider } = require('../test_lib/utils.js');

const TokenHolder = artifacts.require('./TokenHolder.sol');

const CustomRuleDouble = artifacts.require('CustomRuleDouble');
Expand Down Expand Up @@ -958,24 +959,23 @@ contract('TokenHolder::executeRule', async () => {
(await tokenHolder.sessionKeys.call(sessionPublicKey1)).nonce.eqn(1),
);
});
});
});

contract('Verify call prefix constants', async () => {

it('Verify EXECUTE_RULE_CALLPREFIX constant', async () => {
const tokenHolder = await TokenHolder.new();
const tokenHolderExecuteRuleCallPrefix = await tokenHolder.EXECUTE_RULE_CALLPREFIX();
const methodName = "executeRule";
const methodName = 'executeRule';

Utils.verifyCallPrefixConstant(methodName, tokenHolderExecuteRuleCallPrefix, "TokenHolder");
Utils.verifyCallPrefixConstant(methodName, tokenHolderExecuteRuleCallPrefix, 'TokenHolder');
});

it('Verify EXECUTE_REDEMPTION_CALLPREFIX constant', async () => {
const tokenHolder = await TokenHolder.new();
const tokenHolderExecuteRuleCallPrefix = await tokenHolder.EXECUTE_REDEMPTION_CALLPREFIX();
const methodName = "executeRedemption";
const methodName = 'executeRedemption';

Utils.verifyCallPrefixConstant(methodName, tokenHolderExecuteRuleCallPrefix, "TokenHolder");
Utils.verifyCallPrefixConstant(methodName, tokenHolderExecuteRuleCallPrefix, 'TokenHolder');
});
});
});
6 changes: 2 additions & 4 deletions test/user_wallet_factory/create_user_wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,11 @@ contract('UserWalletFactory::createUserWallet', async (accounts) => {

contract('Verify call prefix constants', async () => {
it('Verify TOKENHOLDER_SETUP_CALLPREFIX constant', async () => {

const userWalletFactory = await UserWalletFactory.new();
const tokenHolderSetupCallPrefix = await userWalletFactory.TOKENHOLDER_SETUP_CALLPREFIX();
const methodName = "setup";

Utils.verifyCallPrefixConstant(methodName, tokenHolderSetupCallPrefix, "TokenHolder");
const methodName = 'setup';

Utils.verifyCallPrefixConstant(methodName, tokenHolderSetupCallPrefix, 'TokenHolder');
});
});
});

0 comments on commit c8d1551

Please sign in to comment.