solidity/utils.filters.js
Marek Kotewicz 8cbaec5ce6 Squashed 'libjsqrc/ethereumjs/' changes from a8a2e32..589c4fb
589c4fb formatInput && formatOutput simplified
b20e972 few methods moved to utils

git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: 589c4fb30f2e68972b898c5ce084cda5b0831266
2015-01-31 15:53:50 +01:00

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');
});
});