mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
cover api/ledger/parse/utils.js with tests
This commit is contained in:
@@ -215,6 +215,15 @@ describe('RippleAPI', function() {
|
|||||||
'getTransaction', done));
|
'getTransaction', done));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getTransaction - not validated', function(done) {
|
||||||
|
const hash =
|
||||||
|
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA10';
|
||||||
|
this.api.getTransaction(hash, {}, (error, data) => {
|
||||||
|
assert.deepEqual(data, responses.getTransaction.notValidated);
|
||||||
|
done(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('getTransaction - tracking on', function(done) {
|
it('getTransaction - tracking on', function(done) {
|
||||||
const hash =
|
const hash =
|
||||||
'8925FC8844A1E930E2CC76AD0A15E7665AFCC5425376D548BB1413F484C31B8C';
|
'8925FC8844A1E930E2CC76AD0A15E7665AFCC5425376D548BB1413F484C31B8C';
|
||||||
|
|||||||
11
test/fixtures/api/responses/get-transaction-not-validated.json
vendored
Normal file
11
test/fixtures/api/responses/get-transaction-not-validated.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"type": "settings",
|
||||||
|
"address": "rLVKsA4F9iJBbA6rX2x4wCmkj6drgtqpQe",
|
||||||
|
"sequence": 1,
|
||||||
|
"id": "4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA10",
|
||||||
|
"specification": {
|
||||||
|
"requireAuthorization": true,
|
||||||
|
"disallowIncomingXRP": true,
|
||||||
|
"globalFreeze": false
|
||||||
|
}
|
||||||
|
}
|
||||||
3
test/fixtures/api/responses/index.js
vendored
3
test/fixtures/api/responses/index.js
vendored
@@ -22,7 +22,8 @@ module.exports = {
|
|||||||
trackingOn: require('./get-transaction-settings-tracking-on.json'),
|
trackingOn: require('./get-transaction-settings-tracking-on.json'),
|
||||||
trackingOff: require('./get-transaction-settings-tracking-off.json'),
|
trackingOff: require('./get-transaction-settings-tracking-off.json'),
|
||||||
setRegularKey: require('./get-transaction-settings-set-regular-key.json'),
|
setRegularKey: require('./get-transaction-settings-set-regular-key.json'),
|
||||||
trustlineFrozeOff: require('./get-transaction-trust-set-froze-off.json')
|
trustlineFrozeOff: require('./get-transaction-trust-set-froze-off.json'),
|
||||||
|
notValidated: require('./get-transaction-not-validated.json')
|
||||||
},
|
},
|
||||||
getTransactions: require('./get-transactions.json'),
|
getTransactions: require('./get-transactions.json'),
|
||||||
getTrustlines: require('./get-trustlines.json'),
|
getTrustlines: require('./get-trustlines.json'),
|
||||||
|
|||||||
3
test/fixtures/api/rippled/index.js
vendored
3
test/fixtures/api/rippled/index.js
vendored
@@ -34,6 +34,7 @@ module.exports = {
|
|||||||
NotFound: require('./tx/not-found.json'),
|
NotFound: require('./tx/not-found.json'),
|
||||||
NoLedgerIndex: require('./tx/no-ledger-index.json'),
|
NoLedgerIndex: require('./tx/no-ledger-index.json'),
|
||||||
NoLedgerFound: require('./tx/no-ledger-found.json'),
|
NoLedgerFound: require('./tx/no-ledger-found.json'),
|
||||||
LedgerWithoutTime: require('./tx/ledger-without-time.json')
|
LedgerWithoutTime: require('./tx/ledger-without-time.json'),
|
||||||
|
NotValidated: require('./tx/not-validated.json')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
45
test/fixtures/api/rippled/tx/not-validated.json
vendored
Normal file
45
test/fixtures/api/rippled/tx/not-validated.json
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"status": "success",
|
||||||
|
"type": "response",
|
||||||
|
"result": {
|
||||||
|
"Account": "rLVKsA4F9iJBbA6rX2x4wCmkj6drgtqpQe",
|
||||||
|
"Fee": "10",
|
||||||
|
"Flags": 2147483648,
|
||||||
|
"Sequence": 1,
|
||||||
|
"SetFlag": 2,
|
||||||
|
"SigningPubKey": "03EA3ADCA632F125EC2CC4F7F6A82DE0DCE2B65290CAC1F22242C5163F0DA9652D",
|
||||||
|
"TransactionType": "AccountSet",
|
||||||
|
"TxnSignature": "3045022100DE8B666B1A31EA65011B0F32130AB91A5747E32FA49B3054CEE8E8362DBAB98A022040CF0CF254677A8E5CD04C59CA2ED7F6F15F7E184641BAE169C561650967B226",
|
||||||
|
"date": 460832270,
|
||||||
|
"hash": "4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA10",
|
||||||
|
"inLedger": 8206418,
|
||||||
|
"ledger_index": 8206418,
|
||||||
|
"meta": {
|
||||||
|
"AffectedNodes": [
|
||||||
|
{
|
||||||
|
"ModifiedNode": {
|
||||||
|
"FinalFields": {
|
||||||
|
"Account": "rLVKsA4F9iJBbA6rX2x4wCmkj6drgtqpQe",
|
||||||
|
"Balance": "29999990",
|
||||||
|
"Flags": 786432,
|
||||||
|
"OwnerCount": 0,
|
||||||
|
"Sequence": 2
|
||||||
|
},
|
||||||
|
"LedgerEntryType": "AccountRoot",
|
||||||
|
"LedgerIndex": "3F5072C4875F32ED770DAF3610A716600ED7C7BB0348FADC7A98E011BB2CD36F",
|
||||||
|
"PreviousFields": {
|
||||||
|
"Balance": "30000000",
|
||||||
|
"Flags": 4194304,
|
||||||
|
"Sequence": 1
|
||||||
|
},
|
||||||
|
"PreviousTxnID": "3FB0350A3742BBCC0D8AA3C5247D1AEC01177D0A24D9C34762BAA2FEA8AD88B3",
|
||||||
|
"PreviousTxnLgrSeq": 8206397
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TransactionIndex": 5,
|
||||||
|
"TransactionResult": "tesSUCCESS"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -161,6 +161,9 @@ module.exports = function(port) {
|
|||||||
} else if (request.transaction ===
|
} else if (request.transaction ===
|
||||||
'FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B') {
|
'FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B') {
|
||||||
conn.send(createResponse(request, fixtures.tx.TrustSetFrozeOff));
|
conn.send(createResponse(request, fixtures.tx.TrustSetFrozeOff));
|
||||||
|
} else if (request.transaction ===
|
||||||
|
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA10') {
|
||||||
|
conn.send(createResponse(request, fixtures.tx.NotValidated));
|
||||||
} else if (request.transaction === hashes.NOTFOUND_TRANSACTION_HASH) {
|
} else if (request.transaction === hashes.NOTFOUND_TRANSACTION_HASH) {
|
||||||
conn.send(createResponse(request, fixtures.tx.NotFound));
|
conn.send(createResponse(request, fixtures.tx.NotFound));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user