aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/eth.contract.js31
-rw-r--r--test/eth.event.js0
-rw-r--r--test/event.js25
3 files changed, 55 insertions, 1 deletions
diff --git a/test/eth.contract.js b/test/eth.contract.js
index 945700cf9..1a92ec88f 100644
--- a/test/eth.contract.js
+++ b/test/eth.contract.js
@@ -146,7 +146,6 @@ describe('contract', function() {
// given
var description = [{
"name": "test(uint256)",
- "type": "event",
"inputs": [{
"name": "a",
"type": "uint256"
@@ -168,5 +167,35 @@ describe('contract', function() {
assert.equal('undefined', typeof con.test);
});
+
+ it('should create contract with one event', function () {
+
+ // given
+ var description = [{
+ "name": "test",
+ "type": "event",
+ "inputs": [{
+ "name": "a",
+ "type": "uint256"
+ }
+ ],
+ "outputs": [
+ {
+ "name": "d",
+ "type": "uint256"
+ }
+ ]
+ }];
+
+
+ // when
+ var con = contract(null, description);
+
+ // then
+ assert.equal('function', typeof con.test);
+ assert.equal('function', typeof con.test['uint256']);
+
+ });
+
});
diff --git a/test/eth.event.js b/test/eth.event.js
deleted file mode 100644
index e69de29bb..000000000
--- a/test/eth.event.js
+++ /dev/null
diff --git a/test/event.js b/test/event.js
new file mode 100644
index 000000000..0cc9c0c65
--- /dev/null
+++ b/test/event.js
@@ -0,0 +1,25 @@
+var assert = require('assert');
+var event = require('../lib/event.js');
+
+describe('event', function () {
+ it('should create filter input object from given', function () {
+
+ // given
+ var address = '0x012345';
+ var signature = '0x987654';
+ var e = {
+ name: 'test',
+ type: 'event',
+ };
+
+ // when
+ var impl = event(e, address, signature);
+ var result = impl();
+
+ // then
+ assert.equal(result.address, address);
+ assert.equal(result.topics.length, 1);
+ assert.equal(result.topics[0], signature);
+
+ });
+});