Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Commit

Permalink
fix: fix test and add sorting to show function arr
Browse files Browse the repository at this point in the history
  • Loading branch information
JhChoy committed May 30, 2019
1 parent d715b6e commit 42dddde
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 11 additions & 1 deletion packages/vvisp/scripts/console.js
Expand Up @@ -194,6 +194,16 @@ async function show(args, apis) {
.filter(function(obj) {
return obj.type === 'function';
})
.sort(function(a, b) {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}

return 0;
})
.forEach(function(functionAbi) {
msg =
msg +
Expand All @@ -207,7 +217,7 @@ async function show(args, apis) {

function getArgs(func, functionAbi) {
return functionAbi.inputs.map((input, i) => {
return input.type + ' ' + (input.name || `input${i}`);
return input.type + ' ' + (input.name || `input${i + 1}`);
});
}

Expand Down
14 changes: 7 additions & 7 deletions packages/vvisp/test/scripts/console.test.js
Expand Up @@ -283,14 +283,14 @@ describe('# console script test', async function() {
'\n' +
'[Method]'.padEnd(40) +
'[Args]\n' +
'velocities [_input1]\n' +
'haechiIds [_input1]\n' +
'distances [_input1]\n' +
'distances [uint256 input1]\n' +
'gym []\n' +
'makeNewHaechi [__id, options]\n' +
'increaseVelocity [__haechiId, __diff, options]\n' +
'run [options]\n' +
'initialize [__gym, options]\n\n';
'haechiIds [address input1]\n' +
'increaseVelocity [uint256 _haechiId, uint256 _diff]\n' +
'initialize [address _gym]\n' +
'makeNewHaechi [uint256 _id]\n' +
'run []\n' +
'velocities [uint256 input1]\n\n';

stdMocks.use();

Expand Down

0 comments on commit 42dddde

Please sign in to comment.