Files
xahau.js/test/models/checkCreate.ts
Mayukha Vadari 73109295b4 Rename RippleAPI client to Client (#1520)
* rename RippleAPI -> XrplClient

* more renames

* move API stuff to client folder

* rename all api -> client

* fix tests

* make tests run

* fix integ tests

* fix urls

* fix merge issues

* XrplClient -> Client

* fix merge issues

* rename xrpl-client npm symlink to xrpl-local
2021-10-04 14:10:08 -04:00

123 lines
4.1 KiB
TypeScript

import { ValidationError } from 'xrpl-local/common/errors'
import { verifyCheckCreate } from './../../src/models/transactions/checkCreate'
import { assert } from 'chai'
/**
* CheckCreate Transaction Verification Testing
*
* Providing runtime verification testing for each specific transaction type
*/
describe('CheckCreate Transaction Verification', function () {
it (`verifies valid CheckCreate`, () => {
const validCheck = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
SendMax : "100000000",
Expiration : 570113521,
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
DestinationTag : 1,
Fee : "12"
} as any
assert.doesNotThrow(() => verifyCheckCreate(validCheck))
})
it (`throws w/ invalid Destination`, () => {
const invalidDestination = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : 7896214563214789632154,
SendMax : "100000000",
Expiration : 570113521,
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
DestinationTag : 1,
Fee : "12"
} as any
assert.throws(
() => verifyCheckCreate(invalidDestination),
ValidationError,
"CheckCreate: invalid Destination"
)
})
it (`throws w/ invalid SendMax`, () => {
const invalidSendMax = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
SendMax : 100000000,
Expiration : 570113521,
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
DestinationTag : 1,
Fee : "12"
} as any
assert.throws(
() => verifyCheckCreate(invalidSendMax),
ValidationError,
"CheckCreate: invalid SendMax"
)
})
it (`throws w/ invalid DestinationTag`, () => {
const invalidDestinationTag = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
SendMax : "100000000",
Expiration : 570113521,
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
DestinationTag : "1",
Fee : "12"
} as any
assert.throws(
() => verifyCheckCreate(invalidDestinationTag),
ValidationError,
"CheckCreate: invalid DestinationTag"
)
})
it (`throws w/ invalid Expiration`, () => {
const invalidExpiration = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
SendMax : "100000000",
Expiration : "570113521",
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
DestinationTag : 1,
Fee : "12"
} as any
assert.throws(
() => verifyCheckCreate(invalidExpiration),
ValidationError,
"CheckCreate: invalid Expiration"
)
})
it (`throws w/ invalid InvoiceID`, () => {
const invalidInvoiceID = {
TransactionType : "CheckCreate",
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
SendMax : "100000000",
Expiration : 570113521,
InvoiceID : 7896545655285446963258531,
DestinationTag : 1,
Fee : "12"
} as any
assert.throws(
() => verifyCheckCreate(invalidInvoiceID),
ValidationError,
"CheckCreate: invalid InvoiceID"
)
})
})