fix handling memos in prepareSettings

boost coverage back to 99.88%
move connection tests to separate file
group test fixtures into namespaces
This commit is contained in:
Ivan Tivonenko
2015-11-24 09:49:41 +02:00
parent 27ed1aadd5
commit c9704137b7
21 changed files with 658 additions and 478 deletions

View File

@@ -6,35 +6,42 @@ module.exports = {
sell: require('./prepare-order-sell'),
expiration: require('./prepare-order-expiration')
},
prepareOrderCancellation: require('./prepare-order-cancellation'),
preparePayment: require('./prepare-payment'),
preparePaymentMinAmountXRP: require('./prepare-payment-min-xrp'),
preparePaymentMinAmount: require('./prepare-payment-min'),
preparePaymentWrongAddress: require('./prepare-payment-wrong-address'),
preparePaymentWrongAmount: require('./prepare-payment-wrong-amount'),
preparePaymentWrongPartial: require('./prepare-payment-wrong-partial'),
preparePaymentAllOptions: require('./prepare-payment-all-options'),
preparePaymentNoCounterparty: require('./prepare-payment-no-counterparty'),
prepareOrderCancellation: {
simple: require('./prepare-order-cancellation'),
withMemos: require('./prepare-order-cancellation-memos')
},
preparePayment: {
normal: require('./prepare-payment'),
minAmountXRP: require('./prepare-payment-min-xrp'),
minAmount: require('./prepare-payment-min'),
wrongAddress: require('./prepare-payment-wrong-address'),
wrongAmount: require('./prepare-payment-wrong-amount'),
wrongPartial: require('./prepare-payment-wrong-partial'),
allOptions: require('./prepare-payment-all-options'),
noCounterparty: require('./prepare-payment-no-counterparty')
},
prepareSettings: require('./prepare-settings'),
prepareSuspendedPaymentCreation:
require('./prepare-suspended-payment-creation'),
prepareSuspendedPaymentCreationFull:
require('./prepare-suspended-payment-creation-full'),
prepareSuspendedPaymentExecution:
require('./prepare-suspended-payment-execution'),
prepareSuspendedPaymentExecutionSimple:
require('./prepare-suspended-payment-execution-simple'),
prepareSuspendedPaymentCancellation:
require('./prepare-suspended-payment-cancellation'),
prepareSuspendedPaymentCancellationMemos:
require('./prepare-suspended-payment-cancellation-memos'),
prepareSuspendedPaymentCreation: {
normal: require('./prepare-suspended-payment-creation'),
full: require('./prepare-suspended-payment-creation-full')
},
prepareSuspendedPaymentExecution: {
normal: require('./prepare-suspended-payment-execution'),
simple: require('./prepare-suspended-payment-execution-simple')
},
prepareSuspendedPaymentCancellation: {
normal: require('./prepare-suspended-payment-cancellation'),
memos: require('./prepare-suspended-payment-cancellation-memos')
},
prepareTrustline: {
simple: require('./prepare-trustline-simple'),
complex: require('./prepare-trustline'),
frozen: require('./prepare-trustline-frozen.json')
},
sign: require('./sign'),
signSuspended: require('./sign-suspended.json'),
sign: {
normal: require('./sign'),
suspended: require('./sign-suspended.json')
},
getPaths: {
normal: require('./getpaths/normal'),
UsdToUsd: require('./getpaths/usd2usd'),
@@ -47,8 +54,10 @@ module.exports = {
invalid: require('./getpaths/invalid'),
issuer: require('./getpaths/issuer')
},
getOrderbook: require('./get-orderbook'),
getOrderbookWithXRP: require('./get-orderbook-with-xrp'),
getOrderbook: {
normal: require('./get-orderbook'),
withXRP: require('./get-orderbook-with-xrp')
},
computeLedgerHash: {
header: require('./compute-ledger-hash'),
transactions: require('./compute-ledger-hash-transactions')

View File

@@ -0,0 +1,10 @@
{
"orderSequence": 23,
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
}

View File

@@ -9,5 +9,12 @@
"currency": "XRP",
"value": "2"
},
"immediateOrCancel": true
"immediateOrCancel": true,
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
}

View File

@@ -1,3 +1,10 @@
{
"domain": "ripple.com"
"domain": "ripple.com",
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
}

View File

@@ -5,5 +5,12 @@
"qualityIn": 0.91,
"qualityOut": 0.87,
"ripplingDisabled": true,
"frozen": false
"frozen": false,
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
}

View File

@@ -5,8 +5,10 @@ module.exports = {
getAccountInfo: require('./get-account-info.json'),
getBalances: require('./get-balances.json'),
getBalanceSheet: require('./get-balance-sheet.json'),
getOrderbook: require('./get-orderbook.json'),
getOrderbookWithXRP: require('./get-orderbook-with-xrp.json'),
getOrderbook: {
normal: require('./get-orderbook.json'),
withXRP: require('./get-orderbook-with-xrp.json')
},
getOrders: require('./get-orders.json'),
getPaths: {
XrpToUsd: require('./get-paths.json'),
@@ -43,10 +45,14 @@ module.exports = {
suspendedPaymentExecutionSimple:
require('./get-transaction-suspended-payment-execution-simple.json')
},
getTransactions: require('./get-transactions.json'),
getTransactionsOne: require('./get-transactions-one.json'),
getTrustlines: require('./get-trustlines.json'),
getTrustlinesAll: require('./get-trustlines-all.json'),
getTransactions: {
normal: require('./get-transactions.json'),
one: require('./get-transactions-one.json')
},
getTrustlines: {
filtered: require('./get-trustlines.json'),
all: require('./get-trustlines-all.json')
},
getLedger: {
header: require('./get-ledger'),
full: require('./get-ledger-full'),
@@ -56,10 +62,12 @@ module.exports = {
prepareOrder: {
buy: require('./prepare-order.json'),
sell: require('./prepare-order-sell.json'),
expiration: require('./prepare-order-expiration'),
cancellation: require('./prepare-order-cancellation.json'),
cancellationNoInstructions:
require('./prepare-order-cancellation-no-instructions.json')
expiration: require('./prepare-order-expiration')
},
prepareOrderCancellation: {
normal: require('./prepare-order-cancellation.json'),
withMemos: require('./prepare-order-cancellation-memos.json'),
noInstructions: require('./prepare-order-cancellation-no-instructions.json')
},
preparePayment: {
normal: require('./prepare-payment.json'),
@@ -77,27 +85,30 @@ module.exports = {
flagClear: require('./prepare-settings-flag-clear.json'),
setTransferRate: require('./prepare-settings-set-transfer-rate.json'),
fieldClear: require('./prepare-settings-field-clear.json'),
noInstructions: require('./prepare-settings-no-instructions.json')
noInstructions: require('./prepare-settings-no-instructions.json'),
signed: require('./prepare-settings-signed.json')
},
prepareSuspendedPaymentCreation: {
normal: require('./prepare-suspended-payment-creation'),
full: require('./prepare-suspended-payment-creation-full')
},
prepareSuspendedPaymentExecution: {
normal: require('./prepare-suspended-payment-execution'),
simple: require('./prepare-suspended-payment-execution-simple')
},
prepareSuspendedPaymentCancellation: {
normal: require('./prepare-suspended-payment-cancellation'),
memos: require('./prepare-suspended-payment-cancellation-memos')
},
prepareSuspendedPaymentCreation:
require('./prepare-suspended-payment-creation'),
prepareSuspendedPaymentCreationFull:
require('./prepare-suspended-payment-creation-full'),
prepareSuspendedPaymentExecution:
require('./prepare-suspended-payment-execution'),
prepareSuspendedPaymentExecutionSimple:
require('./prepare-suspended-payment-execution-simple'),
prepareSuspendedPaymentCancellation:
require('./prepare-suspended-payment-cancellation'),
prepareSuspendedPaymentCancellationMemos:
require('./prepare-suspended-payment-cancellation-memos'),
prepareTrustline: {
simple: require('./prepare-trustline-simple.json'),
frozen: require('./prepare-trustline-frozen.json'),
complex: require('./prepare-trustline.json')
},
sign: require('./sign.json'),
signSuspended: require('./sign-suspended.json'),
sign: {
normal: require('./sign.json'),
suspended: require('./sign-suspended.json')
},
submit: require('./submit.json'),
ledgerEvent: require('./ledger-event.json')
};

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"TransactionType\":\"OfferCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":23,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8819954
}
}

View File

@@ -1,8 +1,8 @@
{
"txJSON": "{\"Flags\":2148139008,\"TransactionType\":\"OfferCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TakerGets\":{\"value\":\"10.1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"TakerPays\":\"2000000\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
{
"txJSON": "{\"TransactionType\":\"OfferCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TakerGets\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"10.1\"},\"TakerPays\":\"2000000\",\"Flags\":2148139008,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -1 +1,8 @@
{"txJSON":"{\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Domain\":\"726970706C652E636F6D\",\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}","instructions":{"fee":"0.000012","sequence":23,"maxLedgerVersion":8819954}}
{
"txJSON": "{\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Domain\":\"726970706C652E636F6D\",\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8819954
}
}

View File

@@ -1,4 +1,4 @@
{
"signedTransaction": "12000322000000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D87446304402207660BDEF67105CE1EBA9AD35DC7156BAB43FF1D47633199EE257D70B6B9AAFBF022045A812486A675750B5A3F37131E9F92299728D37FF6BB7195CA5EE881268CB4C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304",
"id": "29D23159EBA79170DCA5EF467CBC15114DBD35B7A8C3DBF76809BA354D00D250"
}
{
"signedTransaction": "12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D87446304402202FBF6A6F74DFDA17C7341D532B66141206BC71A147C08DBDA6A950AA9A1741DC022055859A39F2486A46487F8DA261E3D80B4FDD26178A716A929F26377D1BEC7E43770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304F9EA7C04746573747D0B74657874656420646174617E0A706C61696E2F74657874E1F1",
"id": "4755D26FAC39E3E477870D4E03CC6783DDDF967FFBE240606755D3D03702FC16"
}

View File

@@ -1,5 +1,5 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Domain\":\"726970706C652E636F6D\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"txJSON": "{\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Domain\":\"726970706C652E636F6D\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,

View File

@@ -1,5 +1,5 @@
{
"txJSON": "{\"Flags\":2149711872,\"TransactionType\":\"TrustSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"LimitAmount\":{\"value\":\"10000\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"QualityIn\":910000000,\"QualityOut\":870000000,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"txJSON": "{\"TransactionType\":\"TrustSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"LimitAmount\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"10000\"},\"Flags\":2149711872,\"QualityIn\":910000000,\"QualityOut\":870000000,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,

View File

@@ -5,11 +5,13 @@ module.exports = {
success: require('./submit'),
failure: require('./submit-failed')
},
ledger: require('./ledger'),
ledgerNotFound: require('./ledger-not-found'),
ledgerWithoutCloseTime: require('./ledger-without-close-time'),
ledgerWithSettingsTx: require('./ledger-with-settings-tx'),
ledgerWithStateAsHashes: require('./ledger-with-state-as-hashes'),
ledger: {
normal: require('./ledger'),
notFound: require('./ledger-not-found'),
withoutCloseTime: require('./ledger-without-close-time'),
withSettingsTx: require('./ledger-with-settings-tx'),
withStateAsHashes: require('./ledger-with-state-as-hashes')
},
subscribe: require('./subscribe'),
unsubscribe: require('./unsubscribe'),
account_info: {
@@ -17,14 +19,20 @@ module.exports = {
notfound: require('./account-info-not-found')
},
account_offers: require('./account-offers'),
account_tx: require('./account-tx'),
account_tx_one: require('./get-transactions-one'),
account_tx: {
normal: require('./account-tx'),
one: require('./get-transactions-one')
},
gateway_balances: require('./gateway-balances'),
book_offers: require('./book-offers'),
book_offers_1: require('./book-offers-1'),
book_offers_2: require('./book-offers-2'),
server_info: require('./server-info'),
server_info_error: require('./server-info-error'),
book_offers: {
fabric: require('./book-offers'),
usd_xrp: require('./book-offers-usd-xrp'),
xrp_usd: require('./book-offers-xrp-usd')
},
server_info: {
normal: require('./server-info'),
error: require('./server-info-error')
},
path_find: {
generate: require('./path-find'),
sendUSD: require('./path-find-send-usd'),