fix && tests for #147
This commit is contained in:
parent
9fc557543a
commit
2f45df835a
|
@ -2388,6 +2388,8 @@ var Jsonrpc = function () {
|
||||||
if (arguments.callee._singletonInstance) {
|
if (arguments.callee._singletonInstance) {
|
||||||
return arguments.callee._singletonInstance;
|
return arguments.callee._singletonInstance;
|
||||||
}
|
}
|
||||||
|
arguments.callee._singletonInstance = this;
|
||||||
|
|
||||||
this.messageId = 1;
|
this.messageId = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2388,6 +2388,8 @@ var Jsonrpc = function () {
|
||||||
if (arguments.callee._singletonInstance) {
|
if (arguments.callee._singletonInstance) {
|
||||||
return arguments.callee._singletonInstance;
|
return arguments.callee._singletonInstance;
|
||||||
}
|
}
|
||||||
|
arguments.callee._singletonInstance = this;
|
||||||
|
|
||||||
this.messageId = 1;
|
this.messageId = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,6 +25,8 @@ var Jsonrpc = function () {
|
||||||
if (arguments.callee._singletonInstance) {
|
if (arguments.callee._singletonInstance) {
|
||||||
return arguments.callee._singletonInstance;
|
return arguments.callee._singletonInstance;
|
||||||
}
|
}
|
||||||
|
arguments.callee._singletonInstance = this;
|
||||||
|
|
||||||
this.messageId = 1;
|
this.messageId = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
var chai = require('chai');
|
||||||
|
var assert = chai.assert;
|
||||||
|
var Jsonrpc = require('../lib/web3/jsonrpc');
|
||||||
|
|
||||||
|
describe('lib/web3/jsonrpc', function () {
|
||||||
|
describe('id', function () {
|
||||||
|
it('should increment the id', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var a = Jsonrpc.getInstance();
|
||||||
|
var b = Jsonrpc.getInstance();
|
||||||
|
var method = 'm';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var p1 = a.toPayload(method);
|
||||||
|
var p2 = b.toPayload(method);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(p2.id, p1.id + 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
var assert = require('assert');
|
var chai = require('chai');
|
||||||
|
var assert = chai.assert;
|
||||||
var jsonrpc = require('../lib/web3/jsonrpc');
|
var jsonrpc = require('../lib/web3/jsonrpc');
|
||||||
jsonrpc = new jsonrpc();
|
jsonrpc = new jsonrpc();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue