mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
2994eb4e63
94e0e5a Merge branch 'cpp' into cpp2 8613382 moved comment df17c33 event example c8ee08c contract.js simplified 842b8cf event.js e1c0862 Fix for API. 61e8ae2 events init 2544d2c tests for abi.filters ea7c2fc abi function type 63d9c07 fixed incoming messages 1345a8c log error on console, if api returns an error 83fad0f removed fromFixed, toFixed && offset from tests c2cb2be removed web3.eth.account, fixed #37 09f6335 fixed #23 42a25f2 evaluating solidity method input params git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: 94e0e5ab7d8ec9adcd03fedc3abe5cf6444a5123
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
var assert = require('assert');
|
|
var abi = require('../lib/abi.js');
|
|
|
|
describe('abi', 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 = abi.filterEvents(description);
|
|
var functions = abi.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');
|
|
|
|
});
|
|
});
|