mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-02 10:05:49 +00:00
fix(tests): more unit tests
This commit is contained in:
@@ -1240,5 +1240,61 @@ export default <TestSuite>{
|
||||
responses.preparePaymentChannelClaim.close,
|
||||
'prepare'
|
||||
)
|
||||
},
|
||||
|
||||
'rejects Promise if both sequence and ticketSecuence are set': async (
|
||||
api,
|
||||
address
|
||||
) => {
|
||||
const localInstructions = {
|
||||
ticketSequence: 23,
|
||||
sequence: 23
|
||||
}
|
||||
const txJSON = {
|
||||
TransactionType: 'DepositPreauth',
|
||||
Account: address,
|
||||
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||
Fee: '16'
|
||||
}
|
||||
await assertRejects(
|
||||
api.prepareTransaction(txJSON, localInstructions),
|
||||
ValidationError,
|
||||
'instance is of prohibited type [object Object]'
|
||||
)
|
||||
},
|
||||
|
||||
'sets sequence to 0 if a ticketSequence is passed': async (
|
||||
api,
|
||||
address
|
||||
) => {
|
||||
const localInstructions = {
|
||||
...instructionsWithMaxLedgerVersionOffset,
|
||||
maxFee: '0.000012',
|
||||
ticketSequence: 23
|
||||
}
|
||||
|
||||
const txJSON = {
|
||||
TransactionType: 'Payment',
|
||||
Account: address,
|
||||
Destination: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
|
||||
Amount: {
|
||||
currency: 'USD',
|
||||
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
|
||||
value: '0.01'
|
||||
},
|
||||
SendMax: {
|
||||
currency: 'USD',
|
||||
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
|
||||
value: '0.01'
|
||||
},
|
||||
Flags: 0
|
||||
}
|
||||
|
||||
const response = await api.prepareTransaction(txJSON, localInstructions)
|
||||
assertResultMatch(
|
||||
response,
|
||||
responses.preparePayment.ticket,
|
||||
'prepare'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user