Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cover api/ledger/pathfind.js with tests
- Loading branch information
1 parent
01e9622
commit 6b9710c
Showing
16 changed files
with
328 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
test/fixtures/api/requests/getpaths/no-paths-with-currencies.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J", | ||
"currencies": [ | ||
{ | ||
"currency": "USD" | ||
} | ||
] | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "1000002", | ||
"currency": "USD" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J" | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "1000002", | ||
"currency": "USD" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"source": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59" | ||
}, | ||
"destination": { | ||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"amount": { | ||
"currency": "USD", | ||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM", | ||
"value": "100" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/fixtures/api/requests/getpaths/not-accept-currency.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J" | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "0.000002", | ||
"currency": "GBP" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"source": { | ||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"currencies": [ | ||
{ | ||
"currency": "LTC" | ||
}, | ||
{ | ||
"currency": "USD" | ||
} | ||
] | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"currency": "USD", | ||
"value": "0.000001" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/fixtures/api/requests/getpaths/xrp2xrp-not-enough.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J" | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "1000002", | ||
"currency": "XRP" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J" | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "0.000002", | ||
"currency": "XRP" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\"}]]" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"source": { | ||
"address": "rwBYyfufTzk77zUSKEu4MvixfarC35av1J", | ||
"amount": { | ||
"currency": "XRP", | ||
"value": "0.000002" | ||
} | ||
}, | ||
"destination": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "0.000002", | ||
"currency": "XRP" | ||
} | ||
}, | ||
"paths": "[]" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 20 additions & 0 deletions
20
test/fixtures/api/rippled/ripple-path-find-xrp-to-xrp.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
Oops, something went wrong.