mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Fixes miscommunication with ripplingDisabled in trustlines (#1481)
This commit is contained in:
@@ -27,5 +27,14 @@ export default <TestSuite>{
|
||||
|
||||
'getTrustlines - no options': async (api, address) => {
|
||||
await api.getTrustlines(address)
|
||||
}
|
||||
},
|
||||
|
||||
'getTrustlines - ripplingDisabled works properly': async (api, address) => {
|
||||
const result = await api.getTrustlines(addresses.FOURTH_ACCOUNT)
|
||||
assertResultMatch(
|
||||
result,
|
||||
RESPONSE_FIXTURES.ripplingDisabled,
|
||||
'getTrustlines'
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
22
test/fixtures/responses/get-trustlines-rippling-disabled.json
vendored
Normal file
22
test/fixtures/responses/get-trustlines-rippling-disabled.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"specification": {
|
||||
"limit": "10000000000",
|
||||
"currency": "ETH",
|
||||
"counterparty": "rEyiXgWXCKsh9wXYRrXCYSgCbR1gj3Xd8b",
|
||||
"ripplingDisabled": true
|
||||
},
|
||||
"counterparty": { "limit": "0", "ripplingDisabled": true },
|
||||
"state": { "balance": "0" }
|
||||
},
|
||||
{
|
||||
"specification": {
|
||||
"limit": "10000000000",
|
||||
"currency": "BTC",
|
||||
"counterparty": "rEyiXgWXCKsh9wXYRrXCYSgCbR1gj3Xd8b",
|
||||
"ripplingDisabled": false
|
||||
},
|
||||
"counterparty": { "limit": "0", "ripplingDisabled": true },
|
||||
"state": { "balance": "0" }
|
||||
}
|
||||
]
|
||||
3
test/fixtures/responses/index.js
vendored
3
test/fixtures/responses/index.js
vendored
@@ -102,7 +102,8 @@ module.exports = {
|
||||
item: require('./trustline-item.json'),
|
||||
count: 401
|
||||
}),
|
||||
all: require('./get-trustlines-all.json')
|
||||
all: require('./get-trustlines-all.json'),
|
||||
ripplingDisabled: require('./get-trustlines-rippling-disabled.json')
|
||||
},
|
||||
getLedger: {
|
||||
header: require('./get-ledger'),
|
||||
|
||||
37
test/fixtures/rippled/account-lines.js
vendored
37
test/fixtures/rippled/account-lines.js
vendored
@@ -370,3 +370,40 @@ module.exports.manyItems = function(request, options = {}) {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports.ripplingDisabled = function(request, options = {}) {
|
||||
_.defaults(options, {
|
||||
ledger: BASE_LEDGER_INDEX
|
||||
});
|
||||
|
||||
return JSON.stringify({
|
||||
id: request.id,
|
||||
status: 'success',
|
||||
type: 'response',
|
||||
result: {
|
||||
account: request.account,
|
||||
marker: options.marker,
|
||||
limit: request.limit,
|
||||
ledger_index: options.ledger,
|
||||
lines: [{'account': 'rEyiXgWXCKsh9wXYRrXCYSgCbR1gj3Xd8b',
|
||||
'balance': '0',
|
||||
'currency': 'ETH',
|
||||
'limit': '10000000000',
|
||||
'limit_peer': '0',
|
||||
'no_ripple': true,
|
||||
'no_ripple_peer': true,
|
||||
'quality_in': 0,
|
||||
'quality_out': 0},
|
||||
{'account': 'rEyiXgWXCKsh9wXYRrXCYSgCbR1gj3Xd8b',
|
||||
'balance': '0',
|
||||
'currency': 'BTC',
|
||||
'limit': '10000000000',
|
||||
'limit_peer': '0',
|
||||
'no_ripple': false,
|
||||
'no_ripple_peer': true,
|
||||
'quality_in': 0,
|
||||
'quality_out': 0}]
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -668,6 +668,8 @@ export function createMockRippled(port) {
|
||||
conn.send(accountLinesResponse.counterparty(request))
|
||||
} else if (request.account === addresses.THIRD_ACCOUNT) {
|
||||
conn.send(accountLinesResponse.manyItems(request))
|
||||
} else if (request.account === addresses.FOURTH_ACCOUNT) {
|
||||
conn.send(accountLinesResponse.ripplingDisabled(request))
|
||||
} else if (request.account === addresses.NOTFOUND) {
|
||||
conn.send(createResponse(request, fixtures.account_info.notfound))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user