2015-01-29 13:35:21 +02:00
|
|
|
var assert = require('assert');
|
|
|
|
var event = require('../lib/event.js');
|
|
|
|
|
|
|
|
describe('event', function () {
|
2015-01-31 02:30:19 +02:00
|
|
|
it('should create basic filter input object', function () {
|
2015-01-29 13:35:21 +02:00
|
|
|
|
|
|
|
// given
|
|
|
|
var address = '0x012345';
|
|
|
|
var signature = '0x987654';
|
|
|
|
|
|
|
|
// when
|
2015-01-29 14:32:32 +02:00
|
|
|
var impl = event(address, signature);
|
2015-01-29 13:35:21 +02:00
|
|
|
var result = impl();
|
|
|
|
|
|
|
|
// then
|
|
|
|
assert.equal(result.address, address);
|
2015-01-31 02:30:19 +02:00
|
|
|
assert.equal(result.topic.length, 1);
|
|
|
|
assert.equal(result.topic[0], signature);
|
2015-01-29 13:35:21 +02:00
|
|
|
|
|
|
|
});
|
2015-01-31 02:30:19 +02:00
|
|
|
|
|
|
|
it('should create basic filter input object', function () {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var address = '0x012345';
|
|
|
|
var signature = '0x987654';
|
|
|
|
var options = {
|
|
|
|
earliest: 1,
|
|
|
|
latest: 2,
|
|
|
|
offset: 3,
|
|
|
|
max: 4
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var impl = event(address, signature);
|
|
|
|
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);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-01-29 13:35:21 +02:00
|
|
|
});
|
2015-01-29 14:32:32 +02:00
|
|
|
|