mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-26 07:05:49 +00:00
Merge pull request #446 from darkdarkdragon/develop-RLJS-370-8
Increase tests coverage
This commit is contained in:
@@ -24,7 +24,32 @@
|
|||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": ["address"]
|
"required": ["address"]
|
||||||
},
|
},
|
||||||
"destination": {"$ref": "adjustment"}
|
"destination": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"amount": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"value": {
|
||||||
|
"description": "The quantity of the currency, denoted as a string to retain floating point precision",
|
||||||
|
"$ref": "value"
|
||||||
|
},
|
||||||
|
"currency": {
|
||||||
|
"description": "The three-character code or hex string used to denote currencies",
|
||||||
|
"$ref": "currency"
|
||||||
|
},
|
||||||
|
"counterparty": {
|
||||||
|
"description": "The Ripple account address of the currency's issuer or gateway",
|
||||||
|
"$ref": "address"
|
||||||
|
},
|
||||||
|
"required": ["currency", "value"]
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["address", "amount"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"required": ["source", "destination"],
|
"required": ["source", "destination"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|||||||
@@ -46,19 +46,29 @@ describe('RippleAPI', function() {
|
|||||||
afterEach(setupAPI.teardown);
|
afterEach(setupAPI.teardown);
|
||||||
|
|
||||||
it('preparePayment', function(done) {
|
it('preparePayment', function(done) {
|
||||||
this.api.preparePayment(address, requests.preparePayment, instructions,
|
const localInstructions = _.defaults({
|
||||||
|
maxFee: '0.000012'
|
||||||
|
}, instructions);
|
||||||
|
this.api.preparePayment(address, requests.preparePayment, localInstructions,
|
||||||
_.partial(checkResult, responses.preparePayment, done));
|
_.partial(checkResult, responses.preparePayment, done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment with all options specified', function(done) {
|
it('preparePayment with all options specified', function(done) {
|
||||||
|
const localInstructions = {
|
||||||
|
maxLedgerVersion: this.api.getLedgerVersion() + 100,
|
||||||
|
fee: '0.000012'
|
||||||
|
};
|
||||||
this.api.preparePayment(address, requests.preparePaymentAllOptions,
|
this.api.preparePayment(address, requests.preparePaymentAllOptions,
|
||||||
instructions,
|
localInstructions,
|
||||||
_.partial(checkResult, responses.preparePaymentAllOptions, done));
|
_.partial(checkResult, responses.preparePaymentAllOptions, done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment without counterparty set', function(done) {
|
it('preparePayment without counterparty set', function(done) {
|
||||||
|
const localInstructions = _.defaults({
|
||||||
|
sequence: 23
|
||||||
|
}, instructions);
|
||||||
this.api.preparePayment(address, requests.preparePaymentNoCounterparty,
|
this.api.preparePayment(address, requests.preparePaymentNoCounterparty,
|
||||||
instructions,
|
localInstructions,
|
||||||
_.partial(checkResult, responses.preparePaymentNoCounterparty, done));
|
_.partial(checkResult, responses.preparePaymentNoCounterparty, done));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -258,7 +268,8 @@ describe('RippleAPI', function() {
|
|||||||
it('getOrderbook - direction is correct for bids and asks', function(done) {
|
it('getOrderbook - direction is correct for bids and asks', function(done) {
|
||||||
this.api.getOrderbook(address, orderbook, {}, (error, data) => {
|
this.api.getOrderbook(address, orderbook, {}, (error, data) => {
|
||||||
assert(_.every(data.bids, bid => bid.specification.direction === 'buy'));
|
assert(_.every(data.bids, bid => bid.specification.direction === 'buy'));
|
||||||
assert(_.every(data.asks, ask => ask.specification.direction === 'sell'));
|
assert(
|
||||||
|
_.every(data.asks, ask => ask.specification.direction === 'sell'));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -281,21 +292,50 @@ describe('RippleAPI', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('getPaths', function(done) {
|
it('getPaths', function(done) {
|
||||||
const pathfind = {
|
this.api.getPaths(requests.getPaths.normal,
|
||||||
source: {
|
_.partial(checkResult, responses.getPaths.XrpToUsd, done));
|
||||||
address: address
|
});
|
||||||
},
|
|
||||||
destination: {
|
// @TODO
|
||||||
address: addresses.OTHER_ACCOUNT,
|
// need decide what to do with currencies/XRP:
|
||||||
amount: {
|
// if add 'XRP' in currencies, then there will be exception in
|
||||||
currency: 'USD',
|
// xrpToDrops function (called from toRippledAmount)
|
||||||
counterparty: addresses.ISSUER,
|
it('getPaths USD 2 USD', function(done) {
|
||||||
value: '100'
|
this.api.getPaths(requests.getPaths.UsdToUsd,
|
||||||
}
|
_.partial(checkResult, responses.getPaths.UsdToUsd, done));
|
||||||
}
|
});
|
||||||
};
|
|
||||||
this.api.getPaths(pathfind,
|
it('getPaths XRP 2 XRP', function(done) {
|
||||||
_.partial(checkResult, responses.getPaths, done));
|
this.api.getPaths(requests.getPaths.XrpToXrp,
|
||||||
|
_.partial(checkResult, responses.getPaths.XrpToXrp, done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getPaths - XRP 2 XRP - not enough', function(done) {
|
||||||
|
this.api.getPaths(requests.getPaths.XrpToXrpNotEnough, (error) => {
|
||||||
|
assert(error instanceof this.api.errors.NotFoundError);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getPaths - does not accept currency', function(done) {
|
||||||
|
this.api.getPaths(requests.getPaths.NotAcceptCurrency, (error) => {
|
||||||
|
assert(error instanceof this.api.errors.NotFoundError);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getPaths - no paths', function(done) {
|
||||||
|
this.api.getPaths(requests.getPaths.NoPaths, (error) => {
|
||||||
|
assert(error instanceof this.api.errors.NotFoundError);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getPaths - no paths with source currencies', function(done) {
|
||||||
|
this.api.getPaths(requests.getPaths.NoPathsWithCurrencies, (error) => {
|
||||||
|
assert(error instanceof this.api.errors.NotFoundError);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getLedgerVersion', function() {
|
it('getLedgerVersion', function() {
|
||||||
|
|||||||
17
test/fixtures/api/requests/getpaths/no-paths-with-currencies.json
vendored
Normal file
17
test/fixtures/api/requests/getpaths/no-paths-with-currencies.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J",
|
||||||
|
"currencies": [
|
||||||
|
{
|
||||||
|
"currency": "USD"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "1000002",
|
||||||
|
"currency": "USD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
test/fixtures/api/requests/getpaths/no-paths.json
vendored
Normal file
12
test/fixtures/api/requests/getpaths/no-paths.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J"
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "1000002",
|
||||||
|
"currency": "USD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
test/fixtures/api/requests/getpaths/normal.json
vendored
Normal file
13
test/fixtures/api/requests/getpaths/normal.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||||
|
"value": "100"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
test/fixtures/api/requests/getpaths/not-accept-currency.json
vendored
Normal file
12
test/fixtures/api/requests/getpaths/not-accept-currency.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J"
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "0.000002",
|
||||||
|
"currency": "GBP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
test/fixtures/api/requests/getpaths/usd2usd.json
vendored
Normal file
20
test/fixtures/api/requests/getpaths/usd2usd.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currencies": [
|
||||||
|
{
|
||||||
|
"currency": "LTC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.000001"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
test/fixtures/api/requests/getpaths/xrp2xrp-not-enough.json
vendored
Normal file
12
test/fixtures/api/requests/getpaths/xrp2xrp-not-enough.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J"
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "1000002",
|
||||||
|
"currency": "XRP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
test/fixtures/api/requests/getpaths/xrp2xrp.json
vendored
Normal file
12
test/fixtures/api/requests/getpaths/xrp2xrp.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J"
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "0.000002",
|
||||||
|
"currency": "XRP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
test/fixtures/api/requests/index.js
vendored
11
test/fixtures/api/requests/index.js
vendored
@@ -8,5 +8,14 @@ module.exports = {
|
|||||||
preparePaymentNoCounterparty: require('./prepare-payment-no-counterparty'),
|
preparePaymentNoCounterparty: require('./prepare-payment-no-counterparty'),
|
||||||
prepareSettings: require('./prepare-settings'),
|
prepareSettings: require('./prepare-settings'),
|
||||||
prepareTrustline: require('./prepare-trustline'),
|
prepareTrustline: require('./prepare-trustline'),
|
||||||
sign: require('./sign')
|
sign: require('./sign'),
|
||||||
|
getPaths: {
|
||||||
|
normal: require('./getpaths/normal'),
|
||||||
|
UsdToUsd: require('./getpaths/usd2usd'),
|
||||||
|
XrpToXrp: require('./getpaths/xrp2xrp'),
|
||||||
|
XrpToXrpNotEnough: require('./getpaths/xrp2xrp-not-enough'),
|
||||||
|
NotAcceptCurrency: require('./getpaths/not-accept-currency'),
|
||||||
|
NoPaths: require('./getpaths/no-paths'),
|
||||||
|
NoPathsWithCurrencies: require('./getpaths/no-paths-with-currencies')
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
20
test/fixtures/api/responses/get-paths-send-usd.json
vendored
Normal file
20
test/fixtures/api/responses/get-paths-send-usd.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.000001002",
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "0.000001",
|
||||||
|
"currency": "USD"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"paths": "[[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"account\":\"rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5\"},{\"account\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"currency\":\"USD\",\"issuer\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"},{\"account\":\"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun\"}],[{\"account\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\"},{\"account\":\"rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5\"},{\"account\":\"r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X\"}]]"
|
||||||
|
}
|
||||||
|
]
|
||||||
19
test/fixtures/api/responses/get-paths-xrp-to-xrp.json
vendored
Normal file
19
test/fixtures/api/responses/get-paths-xrp-to-xrp.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J",
|
||||||
|
"amount": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "0.000002"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"amount": {
|
||||||
|
"value": "0.000002",
|
||||||
|
"currency": "XRP"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"paths": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
6
test/fixtures/api/responses/index.js
vendored
6
test/fixtures/api/responses/index.js
vendored
@@ -6,7 +6,11 @@ module.exports = {
|
|||||||
getBalances: require('./get-balances.json'),
|
getBalances: require('./get-balances.json'),
|
||||||
getOrderbook: require('./get-orderbook.json'),
|
getOrderbook: require('./get-orderbook.json'),
|
||||||
getOrders: require('./get-orders.json'),
|
getOrders: require('./get-orders.json'),
|
||||||
getPaths: require('./get-paths.json'),
|
getPaths: {
|
||||||
|
XrpToUsd: require('./get-paths.json'),
|
||||||
|
UsdToUsd: require('./get-paths-send-usd.json'),
|
||||||
|
XrpToXrp: require('./get-paths-xrp-to-xrp.json')
|
||||||
|
},
|
||||||
getServerInfo: require('./get-server-info.json'),
|
getServerInfo: require('./get-server-info.json'),
|
||||||
getSettings: require('./get-settings.json'),
|
getSettings: require('./get-settings.json'),
|
||||||
getTransaction: {
|
getTransaction: {
|
||||||
|
|||||||
6
test/fixtures/api/rippled/index.js
vendored
6
test/fixtures/api/rippled/index.js
vendored
@@ -13,7 +13,11 @@ module.exports = {
|
|||||||
account_tx: require('./account-tx'),
|
account_tx: require('./account-tx'),
|
||||||
book_offers: require('./book-offers'),
|
book_offers: require('./book-offers'),
|
||||||
server_info: require('./server-info'),
|
server_info: require('./server-info'),
|
||||||
ripple_path_find: require('./ripple-path-find'),
|
ripple_path_find: {
|
||||||
|
generate: require('./ripple-path-find'),
|
||||||
|
sendUSD: require('./ripple-path-find-send-usd'),
|
||||||
|
XrpToXrp: require('./ripple-path-find-xrp-to-xrp')
|
||||||
|
},
|
||||||
tx: {
|
tx: {
|
||||||
Payment: require('./tx/payment.json'),
|
Payment: require('./tx/payment.json'),
|
||||||
AccountSet: require('./tx/account-set.json'),
|
AccountSet: require('./tx/account-set.json'),
|
||||||
|
|||||||
90
test/fixtures/api/rippled/ripple-path-find-send-usd.json
vendored
Normal file
90
test/fixtures/api/rippled/ripple-path-find-send-usd.json
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"result": {
|
||||||
|
"alternatives": [
|
||||||
|
{
|
||||||
|
"paths_canonical": [],
|
||||||
|
"paths_computed": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||||
|
"type": 48,
|
||||||
|
"type_hex": "0000000000000030"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "rLMJ4db4uwHcd6NHg6jvTaYb8sH5Gy4tg5",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"account": "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||||
|
"type": 1,
|
||||||
|
"type_hex": "0000000000000001"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"source_amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"value": "0.000001002"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"destination_currencies": [
|
||||||
|
"JOE",
|
||||||
|
"BTC",
|
||||||
|
"DYM",
|
||||||
|
"CNY",
|
||||||
|
"EUR",
|
||||||
|
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||||
|
"MXN",
|
||||||
|
"USD",
|
||||||
|
"XRP"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"status": "success",
|
||||||
|
"type": "response"
|
||||||
|
}
|
||||||
20
test/fixtures/api/rippled/ripple-path-find-xrp-to-xrp.json
vendored
Normal file
20
test/fixtures/api/rippled/ripple-path-find-xrp-to-xrp.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"result": {
|
||||||
|
"alternatives": [],
|
||||||
|
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"destination_currencies": [
|
||||||
|
"JOE",
|
||||||
|
"BTC",
|
||||||
|
"DYM",
|
||||||
|
"CNY",
|
||||||
|
"EUR",
|
||||||
|
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||||
|
"MXN",
|
||||||
|
"USD",
|
||||||
|
"XRP"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"status": "success",
|
||||||
|
"type": "response"
|
||||||
|
}
|
||||||
@@ -100,6 +100,10 @@ module.exports = function(port) {
|
|||||||
conn.send(createResponse(request, fixtures.account_info.normal));
|
conn.send(createResponse(request, fixtures.account_info.normal));
|
||||||
} else if (request.account === addresses.NOTFOUND) {
|
} else if (request.account === addresses.NOTFOUND) {
|
||||||
conn.send(createResponse(request, fixtures.account_info.notfound));
|
conn.send(createResponse(request, fixtures.account_info.notfound));
|
||||||
|
} else if (request.account === addresses.THIRD_ACCOUNT) {
|
||||||
|
const response = _.assign({}, fixtures.account_info.normal);
|
||||||
|
response.Account = addresses.THIRD_ACCOUNT;
|
||||||
|
conn.send(createResponse(request, response));
|
||||||
} else {
|
} else {
|
||||||
assert(false, 'Unrecognized account address: ' + request.account);
|
assert(false, 'Unrecognized account address: ' + request.account);
|
||||||
}
|
}
|
||||||
@@ -179,9 +183,16 @@ module.exports = function(port) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mock.on('request_ripple_path_find', function(request, conn) {
|
mock.on('request_ripple_path_find', function(request, conn) {
|
||||||
const response = fixtures.ripple_path_find.generateIOUPaymentPaths(
|
let response = null;
|
||||||
request.id, request.source_account, request.destination_account,
|
if (request.source_account === addresses.OTHER_ACCOUNT) {
|
||||||
request.destination_amount);
|
response = createResponse(request, fixtures.ripple_path_find.sendUSD);
|
||||||
|
} else if (request.source_account === addresses.THIRD_ACCOUNT) {
|
||||||
|
response = createResponse(request, fixtures.ripple_path_find.XrpToXrp);
|
||||||
|
} else {
|
||||||
|
response = fixtures.ripple_path_find.generate.generateIOUPaymentPaths(
|
||||||
|
request.id, request.source_account, request.destination_account,
|
||||||
|
request.destination_amount);
|
||||||
|
}
|
||||||
conn.send(response);
|
conn.send(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user