mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
8cbaec5ce6
589c4fb formatInput && formatOutput simplified b20e972 few methods moved to utils git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: 589c4fb30f2e68972b898c5ce084cda5b0831266
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
var assert = require('assert');
|
|
var utils = require('../lib/utils.js');
|
|
|
|
describe('utils', function() {
|
|
it('should filter functions and events from input array properly', function () {
|
|
|
|
// given
|
|
var description = [{
|
|
"name": "test",
|
|
"type": "function",
|
|
"inputs": [{
|
|
"name": "a",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"outputs": [
|
|
{
|
|
"name": "d",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
}, {
|
|
"name": "test2",
|
|
"type": "event",
|
|
"inputs": [{
|
|
"name": "a",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"outputs": [
|
|
{
|
|
"name": "d",
|
|
"type": "uint256"
|
|
}
|
|
]
|
|
}];
|
|
|
|
// when
|
|
var events = utils.filterEvents(description);
|
|
var functions = utils.filterFunctions(description);
|
|
|
|
// then
|
|
assert.equal(events.length, 1);
|
|
assert.equal(events[0].name, 'test2');
|
|
assert.equal(functions.length, 1);
|
|
assert.equal(functions[0].name, 'test');
|
|
|
|
});
|
|
});
|