mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 20:55:48 +00:00
Uncomment tests
This commit is contained in:
@@ -6,359 +6,359 @@ var Amount = utils.load_module('amount').Amount;
|
|||||||
var Meta = utils.load_module('meta').Meta;
|
var Meta = utils.load_module('meta').Meta;
|
||||||
|
|
||||||
describe('OrderBook', function() {
|
describe('OrderBook', function() {
|
||||||
// it('toJSON', function() {
|
it('toJSON', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// assert.deepEqual(book.toJSON(), {
|
assert.deepEqual(book.toJSON(), {
|
||||||
// taker_gets: {
|
taker_gets: {
|
||||||
// currency: Currency.from_json('XRP').to_hex()
|
currency: Currency.from_json('XRP').to_hex()
|
||||||
// },
|
},
|
||||||
// taker_pays: {
|
taker_pays: {
|
||||||
// currency: Currency.from_json('BTC').to_hex(),
|
currency: Currency.from_json('BTC').to_hex(),
|
||||||
// issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// book = new Remote().createOrderBook({
|
book = new Remote().createOrderBook({
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.deepEqual(book.toJSON(), {
|
assert.deepEqual(book.toJSON(), {
|
||||||
// taker_gets: {
|
taker_gets: {
|
||||||
// currency: Currency.from_json('BTC').to_hex(),
|
currency: Currency.from_json('BTC').to_hex(),
|
||||||
// issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
||||||
// },
|
},
|
||||||
// taker_pays: {
|
taker_pays: {
|
||||||
// currency: Currency.from_json('XRP').to_hex()
|
currency: Currency.from_json('XRP').to_hex()
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Check orderbook validity', function() {
|
it('Check orderbook validity', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// assert(book.isValid());
|
assert(book.isValid());
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Automatic subscription (based on listeners)', function(done) {
|
it('Automatic subscription (based on listeners)', function(done) {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// book.subscribe = function() {
|
book.subscribe = function() {
|
||||||
// done();
|
done();
|
||||||
// };
|
};
|
||||||
// book.on('model', function(){});
|
book.on('model', function(){});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Subscribe', function(done) {
|
it('Subscribe', function(done) {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// var requestedOffers = false;
|
var requestedOffers = false;
|
||||||
//
|
|
||||||
// book.subscribeTransactions = function() {
|
book.subscribeTransactions = function() {
|
||||||
// assert(requestedOffers);
|
assert(requestedOffers);
|
||||||
// done();
|
done();
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.requestOffers = function(callback) {
|
book.requestOffers = function(callback) {
|
||||||
// requestedOffers = true;
|
requestedOffers = true;
|
||||||
// callback();
|
callback();
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.subscribe();
|
book.subscribe();
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Unsubscribe', function(done) {
|
it('Unsubscribe', function(done) {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// book.once('unsubscribe', function() {
|
book.once('unsubscribe', function() {
|
||||||
// done();
|
done();
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// book.on('model', function(){});
|
book.on('model', function(){});
|
||||||
//
|
|
||||||
// book.unsubscribe();
|
book.unsubscribe();
|
||||||
//
|
|
||||||
// assert(!book._subscribed);
|
assert(!book._subscribed);
|
||||||
// assert(!book._shouldConnect);
|
assert(!book._shouldConnect);
|
||||||
// assert.deepEqual(book.listeners(), []);
|
assert.deepEqual(book.listeners(), []);
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Automatic unsubscription (based on listeners)', function(done) {
|
it('Automatic unsubscription (based on listeners)', function(done) {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// book.unsubscribe = function() {
|
book.unsubscribe = function() {
|
||||||
// done();
|
done();
|
||||||
// };
|
};
|
||||||
// book.on('model', function(){});
|
book.on('model', function(){});
|
||||||
// book.removeAllListeners('model');
|
book.removeAllListeners('model');
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Add cached owner funds', function() {
|
it('Add cached owner funds', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// assert.strictEqual(book.getCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'), '1');
|
assert.strictEqual(book.getCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'), '1');
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Add cached owner funds - invalid account', function() {
|
it('Add cached owner funds - invalid account', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.addCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Has cached owner funds', function() {
|
it('Has cached owner funds', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Has cached owner funds - invalid account', function() {
|
it('Has cached owner funds - invalid account', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.addCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Remove cached owner funds', function() {
|
it('Remove cached owner funds', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
// book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
||||||
// book.removeCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji');
|
book.removeCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji');
|
||||||
// assert(!book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
assert(!book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Remove cached owner funds', function() {
|
it('Remove cached owner funds', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
book.addCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji', '1');
|
||||||
// assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
assert(book.hasCachedFunds('rrrrrrrrrrrrrrrrrrrrBZbvji'));
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.removeCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji');
|
book.removeCachedFunds('0rrrrrrrrrrrrrrrrrrrrBZbvji');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Increment offer count', function() {
|
it('Increment offer count', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.strictEqual(book.incrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 1);
|
assert.strictEqual(book.incrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 1);
|
||||||
// assert.strictEqual(book.getOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 1);
|
assert.strictEqual(book.getOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 1);
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Increment offer count - invalid address', function() {
|
it('Increment offer count - invalid address', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.incrementOfferCount('zrrrrrrrrrrrrrrrrrrrBZbvji');
|
book.incrementOfferCount('zrrrrrrrrrrrrrrrrrrrBZbvji');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Decrement offer count', function() {
|
it('Decrement offer count', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// book.incrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji');
|
book.incrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji');
|
||||||
// assert.strictEqual(book.decrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 0);
|
assert.strictEqual(book.decrementOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 0);
|
||||||
// assert.strictEqual(book.getOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 0);
|
assert.strictEqual(book.getOfferCount('rrrrrrrrrrrrrrrrrrrrBZbvji'), 0);
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Decrement offer count - invalid address', function() {
|
it('Decrement offer count - invalid address', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.decrementOfferCount('zrrrrrrrrrrrrrrrrrrrBZbvji');
|
book.decrementOfferCount('zrrrrrrrrrrrrrrrrrrrBZbvji');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Apply transfer rate', function() {
|
it('Apply transfer rate', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.strictEqual(book.applyTransferRate('1', 1002000000), '0.9980039920159681');
|
assert.strictEqual(book.applyTransferRate('1', 1002000000), '0.9980039920159681');
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Apply transfer rate - cached transfer rate', function() {
|
it('Apply transfer rate - cached transfer rate', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// book._issuerTransferRate = 1002000000;
|
book._issuerTransferRate = 1002000000;
|
||||||
// assert.strictEqual(book.applyTransferRate('1'), '0.9980039920159681');
|
assert.strictEqual(book.applyTransferRate('1'), '0.9980039920159681');
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Apply transfer rate - invalid balance', function() {
|
it('Apply transfer rate - invalid balance', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.applyTransferRate('asdf');
|
book.applyTransferRate('asdf');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Apply transfer rate - invalid transfer rate', function() {
|
it('Apply transfer rate - invalid transfer rate', function() {
|
||||||
// var book = new Remote().createOrderBook({
|
var book = new Remote().createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
// assert.throws(function() {
|
assert.throws(function() {
|
||||||
// book.applyTransferRate('1', 'asdf');
|
book.applyTransferRate('1', 'asdf');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Request transfer rate', function() {
|
it('Request transfer rate', function() {
|
||||||
// var remote = new Remote();
|
var remote = new Remote();
|
||||||
// var book = remote.createOrderBook({
|
var book = remote.createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// remote.request = function(request) {
|
remote.request = function(request) {
|
||||||
// assert.deepEqual(request.message, {
|
assert.deepEqual(request.message, {
|
||||||
// command: 'account_info',
|
command: 'account_info',
|
||||||
// id: void(0),
|
id: void(0),
|
||||||
// ident: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
ident: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// account: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
account: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
||||||
// });
|
});
|
||||||
// request.emit('success', {
|
request.emit('success', {
|
||||||
// account_data: {
|
account_data: {
|
||||||
// TransferRate: 1002000000
|
TransferRate: 1002000000
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.requestTransferRate(function(err, rate) {
|
book.requestTransferRate(function(err, rate) {
|
||||||
// assert.ifError(err);
|
assert.ifError(err);
|
||||||
// assert.strictEqual(rate, 1002000000);
|
assert.strictEqual(rate, 1002000000);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Request transfer rate - cached transfer rate', function() {
|
it('Request transfer rate - cached transfer rate', function() {
|
||||||
// var remote = new Remote();
|
var remote = new Remote();
|
||||||
// var book = remote.createOrderBook({
|
var book = remote.createOrderBook({
|
||||||
// currency_gets: 'BTC',
|
currency_gets: 'BTC',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'XRP'
|
currency_pays: 'XRP'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// book._issuerTransferRate = 1002000000;
|
book._issuerTransferRate = 1002000000;
|
||||||
//
|
|
||||||
// remote.request = function(request) {
|
remote.request = function(request) {
|
||||||
// assert(false);
|
assert(false);
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.requestTransferRate(function(err, rate) {
|
book.requestTransferRate(function(err, rate) {
|
||||||
// assert.ifError(err);
|
assert.ifError(err);
|
||||||
// assert.strictEqual(rate, 1002000000);
|
assert.strictEqual(rate, 1002000000);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Request transfer rate - native currency', function() {
|
it('Request transfer rate - native currency', function() {
|
||||||
// var remote = new Remote();
|
var remote = new Remote();
|
||||||
// var book = remote.createOrderBook({
|
var book = remote.createOrderBook({
|
||||||
// currency_gets: 'XRP',
|
currency_gets: 'XRP',
|
||||||
// issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_pays: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_pays: 'BTC'
|
currency_pays: 'BTC'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// remote.request = function(request) {
|
remote.request = function(request) {
|
||||||
// assert(false);
|
assert(false);
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.requestTransferRate(function(err, rate) {
|
book.requestTransferRate(function(err, rate) {
|
||||||
// assert.ifError(err);
|
assert.ifError(err);
|
||||||
// assert.strictEqual(rate, 1000000000);
|
assert.strictEqual(rate, 1000000000);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// it('Set funded amount - funded', function() {
|
it('Set funded amount - funded', function() {
|
||||||
// var remote = new Remote();
|
var remote = new Remote();
|
||||||
// var book = remote.createOrderBook({
|
var book = remote.createOrderBook({
|
||||||
// currency_pays: 'XRP',
|
currency_pays: 'XRP',
|
||||||
// issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
issuer_gets: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||||
// currency_gets: 'BTC'
|
currency_gets: 'BTC'
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// var offer = {
|
var offer = {
|
||||||
// TakerGets: {
|
TakerGets: {
|
||||||
// value: '100',
|
value: '100',
|
||||||
// currency: 'BTC',
|
currency: 'BTC',
|
||||||
// issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji'
|
||||||
// },
|
},
|
||||||
// TakerPays: '123456'
|
TakerPays: '123456'
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// book.setFundedAmount(offer, '100.1234');
|
book.setFundedAmount(offer, '100.1234');
|
||||||
//
|
|
||||||
// var expected = {
|
var expected = {
|
||||||
// TakerGets: offer.TakerGets,
|
TakerGets: offer.TakerGets,
|
||||||
// TakerPays: offer.TakerPays,
|
TakerPays: offer.TakerPays,
|
||||||
// is_fully_funded: true,
|
is_fully_funded: true,
|
||||||
// taker_gets_funded: '100',
|
taker_gets_funded: '100',
|
||||||
// taker_pays_funded: '123456'
|
taker_pays_funded: '123456'
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// assert.deepEqual(offer, expected);
|
assert.deepEqual(offer, expected);
|
||||||
// });
|
});
|
||||||
|
|
||||||
it('Set funded amount - unfunded', function() {
|
it('Set funded amount - unfunded', function() {
|
||||||
var remote = new Remote();
|
var remote = new Remote();
|
||||||
@@ -1378,7 +1378,7 @@ describe('OrderBook', function() {
|
|||||||
Sequence: 561,
|
Sequence: 561,
|
||||||
TransferRate: 1002000000,
|
TransferRate: 1002000000,
|
||||||
index: 'B7D526FDDF9E3B3F95C3DC97C353065B0482302500BBB8051A5C090B596C6133',
|
index: 'B7D526FDDF9E3B3F95C3DC97C353065B0482302500BBB8051A5C090B596C6133',
|
||||||
urlgravatar: 'http://www.gravatar.com/avatar/5b33b93c7ffe384d53450fc666bb11fb'
|
urlgravatar: 'http:www.gravatar.com/avatar/5b33b93c7ffe384d53450fc666bb11fb'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user