mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-27 15:45:48 +00:00
Merge branch 'develop' of https://github.com/ripple/ripple-lib into develop
This commit is contained in:
@@ -421,12 +421,11 @@ Remote.prototype.getPendingTransactions = function() {
|
|||||||
|
|
||||||
var transaction = self.transaction();
|
var transaction = self.transaction();
|
||||||
transaction.parseJson(tx.tx_json);
|
transaction.parseJson(tx.tx_json);
|
||||||
|
transaction.clientID(tx.clientID);
|
||||||
Object.keys(tx).forEach(function(prop) {
|
Object.keys(tx).forEach(function(prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 'secret':
|
case 'secret':
|
||||||
case 'submittedIDs':
|
case 'submittedIDs':
|
||||||
case 'clientID':
|
|
||||||
case 'submitIndex':
|
case 'submitIndex':
|
||||||
transaction[prop] = tx[prop];
|
transaction[prop] = tx[prop];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ var Remote = utils.load_module('remote').Remote;
|
|||||||
var Server = utils.load_module('server').Server;
|
var Server = utils.load_module('server').Server;
|
||||||
var Request = utils.load_module('request').Request;
|
var Request = utils.load_module('request').Request;
|
||||||
|
|
||||||
var options, spy, mock, stub, remote, callback;
|
var options, spy, mock, stub, remote, callback, database, tx;
|
||||||
|
|
||||||
describe('Remote', function () {
|
describe('Remote', function () {
|
||||||
describe('initialing a remote with options', function () {
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
options = {
|
options = {
|
||||||
trace : true,
|
trace : true,
|
||||||
@@ -32,10 +31,16 @@ describe('Remote', function () {
|
|||||||
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
describe('initialing a remote with options', function () {
|
||||||
it('should add a server for each specified', function (done) {
|
it('should add a server for each specified', function (done) {
|
||||||
var remote = new Remote(options);
|
var remote = new Remote(options);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('functions that return request objects', function () {
|
describe('functions that return request objects', function () {
|
||||||
@@ -100,4 +105,89 @@ describe('Remote', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
describe('create remote and get pending transactions', function() {
|
||||||
|
before(function() {
|
||||||
|
tx = [{
|
||||||
|
tx_json: {
|
||||||
|
Account : "r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS",
|
||||||
|
Amount : {
|
||||||
|
currency : "LTC",
|
||||||
|
issuer : "r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS",
|
||||||
|
value : "9.985"
|
||||||
|
},
|
||||||
|
Destination : "r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS",
|
||||||
|
Fee : "15",
|
||||||
|
Flags : 0,
|
||||||
|
Paths : [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
account : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
currency : "USD",
|
||||||
|
issuer : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
type : 49,
|
||||||
|
type_hex : "0000000000000031"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
currency : "LTC",
|
||||||
|
issuer : "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||||
|
type : 48,
|
||||||
|
type_hex : "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
account : "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||||
|
currency : "LTC",
|
||||||
|
issuer : "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX",
|
||||||
|
type : 49,
|
||||||
|
type_hex : "0000000000000031"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
SendMax : {
|
||||||
|
currency : "USD",
|
||||||
|
issuer : "r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS",
|
||||||
|
value : "30.30993068"
|
||||||
|
},
|
||||||
|
Sequence : 415,
|
||||||
|
SigningPubKey : "02854B06CE8F3E65323F89260E9E19B33DA3E01B30EA4CA172612DE77973FAC58A",
|
||||||
|
TransactionType : "Payment",
|
||||||
|
TxnSignature : "304602210096C2F385530587DE573936CA51CB86B801A28F777C944E268212BE7341440B7F022100EBF0508A9145A56CDA7FAF314DF3BBE51C6EE450BA7E74D88516891A3608644E"
|
||||||
|
},
|
||||||
|
clientID: '48631',
|
||||||
|
state: 'pending',
|
||||||
|
submitIndex: 1,
|
||||||
|
submittedIDs: ["304602210096C2F385530587DE573936CA51CB86B801A28F777C944E268212BE7341440B7F022100EBF0508A9145A56CDA7FAF314DF3BBE51C6EE450BA7E74D88516891A3608644E"],
|
||||||
|
secret: 'mysecret'
|
||||||
|
}];
|
||||||
|
database = {
|
||||||
|
getPendingTransactions: function(callback) {
|
||||||
|
callback(null, tx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should set transaction members correct ', function(done) {
|
||||||
|
remote = new Remote(options);
|
||||||
|
remote.storage = database;
|
||||||
|
remote.transaction = function() {
|
||||||
|
return {
|
||||||
|
clientID: function(id) {
|
||||||
|
if (typeof id === 'string') {
|
||||||
|
this._clientID = id;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
submit: function() {
|
||||||
|
assert.deepEqual(this._clientID, tx[0].clientID);
|
||||||
|
assert.deepEqual(this.submittedIDs,[tx[0].tx_json.TxnSignature]);
|
||||||
|
assert.equal(this.submitIndex, tx[0].submitIndex);
|
||||||
|
assert.equal(this.secret, tx[0].secret);
|
||||||
|
done();
|
||||||
|
|
||||||
|
},
|
||||||
|
parseJson: function(json) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remote.getPendingTransactions();
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user