Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/test/event.js

51 lines
1.3 KiB

10 years ago
var assert = require('assert');
var event = require('../lib/event.js');
describe('event', function () {
10 years ago
it('should create basic filter input object', function () {
10 years ago
// given
var address = '0x012345';
var signature = '0x987654';
// when
var impl = event(address, signature);
10 years ago
var result = impl();
// then
assert.equal(result.address, address);
10 years ago
assert.equal(result.topic.length, 1);
assert.equal(result.topic[0], signature);
10 years ago
});
10 years ago
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);
});
10 years ago
});