mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
Merge pull request #195 from ripple/use-ledgerselect
Switch account requests to use ledgerSelect rather than ledgerChoose
This commit is contained in:
@@ -276,7 +276,6 @@ describe('OrderBook', function() {
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'account_info',
|
||||
id: void(0),
|
||||
ident: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
account: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
||||
});
|
||||
request.emit('success', {
|
||||
@@ -1360,7 +1359,6 @@ describe('OrderBook', function() {
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'account_info',
|
||||
id: undefined,
|
||||
ident: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
account: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B'
|
||||
});
|
||||
|
||||
|
||||
@@ -185,12 +185,43 @@ describe('Remote', function () {
|
||||
assert(request instanceof Request);
|
||||
});
|
||||
|
||||
it('request account balance with ledger', function() {
|
||||
it('request account info with ledger index', function() {
|
||||
var request = remote.requestAccountInfo('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 9592219);
|
||||
assert.strictEqual(request.message.command, 'account_info');
|
||||
assert.strictEqual(request.message.account, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_index, 9592219);
|
||||
});
|
||||
it('request account info with ledger hash', function() {
|
||||
var request = remote.requestAccountInfo('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
assert.strictEqual(request.message.command, 'account_info');
|
||||
assert.strictEqual(request.message.account, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_hash, 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
});
|
||||
it('request account info with ledger identifier', function() {
|
||||
var request = remote.requestAccountInfo('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 'validated');
|
||||
assert.strictEqual(request.message.command, 'account_info');
|
||||
assert.strictEqual(request.message.account, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_index, 'validated');
|
||||
});
|
||||
|
||||
it('request account balance with ledger index', function() {
|
||||
var request = remote.requestAccountBalance('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 9592219);
|
||||
assert.strictEqual(request.message.command, 'ledger_entry');
|
||||
assert.strictEqual(request.message.account_root, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_index, 9592219);
|
||||
});
|
||||
it('request account balance with ledger hash', function() {
|
||||
var request = remote.requestAccountBalance('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
assert.strictEqual(request.message.command, 'ledger_entry');
|
||||
assert.strictEqual(request.message.account_root, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_hash, 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
});
|
||||
it('request account balance with ledger identifier', function() {
|
||||
var request = remote.requestAccountBalance('r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS', 'validated');
|
||||
assert.strictEqual(request.message.command, 'ledger_entry');
|
||||
assert.strictEqual(request.message.account_root, 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS');
|
||||
assert.strictEqual(request.message.ledger_index, 'validated');
|
||||
});
|
||||
})
|
||||
|
||||
it('create remote and get pending transactions', function() {
|
||||
|
||||
@@ -355,13 +355,20 @@ describe('Request', function() {
|
||||
assert.strictEqual(request.message.ledger_hash, 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
});
|
||||
|
||||
it('Select ledger - hash', function() {
|
||||
it('Select ledger - undefined', function() {
|
||||
var remote = new Remote();
|
||||
remote._connected = true;
|
||||
|
||||
var request = new Request(remote, 'server_info');
|
||||
request.ledgerSelect('B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
assert.strictEqual(request.message.ledger_hash, 'B4FD84A73DBD8F0DA9E320D137176EBFED969691DC0AAC7882B76B595A0841AE');
|
||||
request.ledgerSelect();
|
||||
assert.strictEqual(request.message.ledger_hash, void(0));
|
||||
assert.strictEqual(request.message.ledger_index, void(0));
|
||||
request.ledgerSelect(null);
|
||||
assert.strictEqual(request.message.ledger_hash, void(0));
|
||||
assert.strictEqual(request.message.ledger_index, void(0));
|
||||
request.ledgerSelect(NaN);
|
||||
assert.strictEqual(request.message.ledger_hash, void(0));
|
||||
assert.strictEqual(request.message.ledger_index, void(0));
|
||||
});
|
||||
|
||||
it('Set account_root', function() {
|
||||
|
||||
Reference in New Issue
Block a user