aboutsummaryrefslogtreecommitdiffstats
path: root/test/event.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-03 23:20:26 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-03 23:20:26 +0800
commitf1a5cf9128170b85428259c8b0ecfaed5b3e17d1 (patch)
tree9baf54fd2db882b95018fcd66238702b29035abf /test/event.js
parent4bb5ba78b0f3d906743874aa8c0cb980b2ad0055 (diff)
parenta5909d82eb16d6e631bd5f89d700eced205b2fcf (diff)
downloaddexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar.gz
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar.bz2
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar.lz
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar.xz
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.tar.zst
dexon-f1a5cf9128170b85428259c8b0ecfaed5b3e17d1.zip
Merge branch 'develop' into cpp
Conflicts: dist/ethereum.js.map dist/ethereum.min.js
Diffstat (limited to 'test/event.js')
-rw-r--r--test/event.js124
1 files changed, 0 insertions, 124 deletions
diff --git a/test/event.js b/test/event.js
deleted file mode 100644
index 9edd93ae7..000000000
--- a/test/event.js
+++ /dev/null
@@ -1,124 +0,0 @@
-var assert = require('assert');
-var event = require('../lib/event.js');
-var f = require('../lib/formatters.js');
-
-describe('event', function () {
- it('should create basic filter input object', function () {
-
- // given
- var address = '0x012345';
- var signature = '0x987654';
- var e = {
- name: 'Event',
- inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
- };
-
- // when
- var impl = event(address, signature, e);
- var result = impl();
-
- // then
- assert.equal(result.address, address);
- assert.equal(result.topic.length, 1);
- assert.equal(result.topic[0], signature);
-
- });
-
- it('should create filter input object with options', function () {
-
- // given
- var address = '0x012345';
- var signature = '0x987654';
- var options = {
- earliest: 1,
- latest: 2,
- offset: 3,
- max: 4
- };
- var e = {
- name: 'Event',
- inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
- };
-
- // when
- var impl = event(address, signature, e);
- var result = impl({}, options);
-
- // then
- assert.equal(result.address, address);
- assert.equal(result.topic.length, 1);
- assert.equal(result.topic[0], signature);
- assert.equal(result.earliest, options.earliest);
- assert.equal(result.latest, options.latest);
- assert.equal(result.offset, options.offset);
- assert.equal(result.max, options.max);
-
- });
-
- it('should create filter input object with indexed params', function () {
-
- // given
- var address = '0x012345';
- var signature = '0x987654';
- var options = {
- earliest: 1,
- latest: 2,
- offset: 3,
- max: 4
- };
- var e = {
- name: 'Event',
- inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
- };
-
- // when
- var impl = event(address, signature, e);
- var result = impl({a: 4}, options);
-
- // then
- assert.equal(result.address, address);
- assert.equal(result.topic.length, 2);
- assert.equal(result.topic[0], signature);
- assert.equal(result.topic[1], f.formatInputInt(4));
- assert.equal(result.earliest, options.earliest);
- assert.equal(result.latest, options.latest);
- assert.equal(result.offset, options.offset);
- assert.equal(result.max, options.max);
-
- });
-
- it('should create filter input object with an array of indexed params', function () {
-
- // given
- var address = '0x012345';
- var signature = '0x987654';
- var options = {
- earliest: 1,
- latest: 2,
- offset: 3,
- max: 4
- };
- var e = {
- name: 'Event',
- inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
- };
-
- // when
- var impl = event(address, signature, e);
- var result = impl({a: [4, 69]}, options);
-
- // then
- assert.equal(result.address, address);
- assert.equal(result.topic.length, 2);
- assert.equal(result.topic[0], signature);
- assert.equal(result.topic[1][0], f.formatInputInt(4));
- assert.equal(result.topic[1][1], f.formatInputInt(69));
- assert.equal(result.earliest, options.earliest);
- assert.equal(result.latest, options.latest);
- assert.equal(result.offset, options.offset);
- assert.equal(result.max, options.max);
-
- });
-
-});
-