diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-28 21:39:10 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-28 21:39:10 +0800 |
commit | 2544d2c952dc003d62bdb99a554b3fa576b202c5 (patch) | |
tree | 8af0e15b3b26b3a107a32d6a406054c0614a1e52 /test | |
parent | ea7c2fc673db31f96583e4712aa0fb78f5d709eb (diff) | |
download | dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar.gz dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar.bz2 dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar.lz dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar.xz dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.tar.zst dexon-2544d2c952dc003d62bdb99a554b3fa576b202c5.zip |
tests for abi.filters
Diffstat (limited to 'test')
-rw-r--r-- | test/abi.filters.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/abi.filters.js b/test/abi.filters.js new file mode 100644 index 000000000..42385fd2a --- /dev/null +++ b/test/abi.filters.js @@ -0,0 +1,49 @@ +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'); + + }); +}); |