Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cover src/api/transaction/payment.js with unit tests
- Loading branch information
1 parent
e997c44
commit 040298d
Showing
7 changed files
with
172 additions
and
0 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
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
30 changes: 30 additions & 0 deletions
30
test/fixtures/api/requests/prepare-payment-all-options.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,30 @@ | ||
{ | ||
"source": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "0.01", | ||
"currency": "XRP" | ||
}, | ||
"tag": 14 | ||
}, | ||
"destination": { | ||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"amount": { | ||
"value": "0.01", | ||
"currency": "XRP" | ||
}, | ||
"tag": 58 | ||
}, | ||
"memos": [ | ||
{ | ||
"type": "test", | ||
"format": "plain/text", | ||
"data": "texted data" | ||
} | ||
], | ||
"invoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A", | ||
"allowPartialPayment": true, | ||
"noDirectRipple": true, | ||
"limitQuality": true, | ||
"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\"}]]" | ||
} |
30 changes: 30 additions & 0 deletions
30
test/fixtures/api/requests/prepare-payment-no-counterparty.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,30 @@ | ||
{ | ||
"source": { | ||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"amount": { | ||
"value": "0.01", | ||
"currency": "USD" | ||
}, | ||
"tag": 14 | ||
}, | ||
"destination": { | ||
"address": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"amount": { | ||
"value": "0.01", | ||
"currency": "LTC" | ||
}, | ||
"tag": 58 | ||
}, | ||
"memos": [ | ||
{ | ||
"type": "test", | ||
"format": "plain/text", | ||
"data": "texted data" | ||
} | ||
], | ||
"invoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A", | ||
"allowPartialPayment": true, | ||
"noDirectRipple": true, | ||
"limitQuality": true, | ||
"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\"}]]" | ||
} |
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
43 changes: 43 additions & 0 deletions
43
test/fixtures/api/responses/prepare-payment-all-options.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,43 @@ | ||
{ | ||
"Flags": 458752, | ||
"TransactionType": "Payment", | ||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"Destination": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"Amount": "10000", | ||
"InvoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A", | ||
"SourceTag": 14, | ||
"DestinationTag": 58, | ||
"Paths": [ | ||
[ | ||
{ | ||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", | ||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", | ||
"currency": "USD", | ||
"type_hex": "0000000000000031" | ||
}, | ||
{ | ||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"currency": "LTC", | ||
"type_hex": "0000000000000030" | ||
}, | ||
{ | ||
"account": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"currency": "LTC", | ||
"type_hex": "0000000000000031" | ||
} | ||
] | ||
], | ||
"Memos": [ | ||
{ | ||
"Memo": { | ||
"MemoType": "74657374", | ||
"MemoFormat": "706C61696E2F74657874", | ||
"MemoData": "7465787465642064617461" | ||
} | ||
} | ||
], | ||
"LastLedgerSequence": 8820051, | ||
"Fee": "12", | ||
"Sequence": 23 | ||
} |
52 changes: 52 additions & 0 deletions
52
test/fixtures/api/responses/prepare-payment-no-counterparty.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,52 @@ | ||
{ | ||
"Flags": 458752, | ||
"TransactionType": "Payment", | ||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | ||
"Destination": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", | ||
"Amount": { | ||
"value": "0.01", | ||
"currency": "LTC", | ||
"issuer": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo" | ||
}, | ||
"InvoiceID": "A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A", | ||
"SourceTag": 14, | ||
"DestinationTag": 58, | ||
"Paths": [ | ||
[ | ||
{ | ||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", | ||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", | ||
"currency": "USD", | ||
"type_hex": "0000000000000031" | ||
}, | ||
{ | ||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"currency": "LTC", | ||
"type_hex": "0000000000000030" | ||
}, | ||
{ | ||
"account": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"issuer": "rfYv1TXnwgDDK4WQNbFALykYuEBnrR4pDX", | ||
"currency": "LTC", | ||
"type_hex": "0000000000000031" | ||
} | ||
] | ||
], | ||
"Memos": [ | ||
{ | ||
"Memo": { | ||
"MemoType": "74657374", | ||
"MemoFormat": "706C61696E2F74657874", | ||
"MemoData": "7465787465642064617461" | ||
} | ||
} | ||
], | ||
"SendMax": { | ||
"value": "0.01", | ||
"currency": "USD", | ||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59" | ||
}, | ||
"LastLedgerSequence": 8820051, | ||
"Fee": "12", | ||
"Sequence": 23 | ||
} |