mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 17:45:49 +00:00
Fix error on ledger subscription message without validated_ledgers
This commit is contained in:
@@ -42,7 +42,6 @@ describe('RippleAPIBroadcast', function() {
|
||||
this.mocks.forEach(mock => mock.socket.send(JSON.stringify(ledgerNext)));
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('-- ledgerVersion', this.api.ledgerVersion);
|
||||
assert.strictEqual(gotLedger, 1);
|
||||
done();
|
||||
}, 50);
|
||||
|
||||
@@ -7,6 +7,7 @@ const assert = require('assert-diff');
|
||||
const setupAPI = require('./setup-api');
|
||||
const RippleAPI = require('ripple-api').RippleAPI;
|
||||
const utils = RippleAPI._PRIVATE.ledgerUtils;
|
||||
const ledgerClose = require('./fixtures/rippled/ledger-close.json');
|
||||
|
||||
|
||||
function unused() {
|
||||
@@ -261,4 +262,13 @@ describe('Connection', function() {
|
||||
|
||||
this.api.connection._onMessage(JSON.stringify({type: 'unknown'}));
|
||||
});
|
||||
|
||||
it('ledger close without validated_ledgers', function(done) {
|
||||
const message = _.omit(ledgerClose, 'validated_ledgers');
|
||||
this.api.on('ledger', function(ledger) {
|
||||
assert.strictEqual(ledger.ledgerVersion, 8819951);
|
||||
done();
|
||||
});
|
||||
this.api.connection._ws.emit('message', JSON.stringify(message));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user