Issue 2212. Improve NFToken.URI handling for empty and undefined values (#2218)

* Handle undefined and null values in transactions better.
This commit is contained in:
Alexey Novikov
2023-03-10 10:34:28 +13:00
committed by GitHub
parent b3d3bc2f99
commit 97ff2aa104
6 changed files with 211 additions and 20 deletions

View File

@@ -68,6 +68,26 @@ describe('NFTokenMint', function () {
)
})
it(`throws w/ URI being an empty string`, function () {
const invalid = {
TransactionType: 'NFTokenMint',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
Fee: '5000000',
Sequence: 2470665,
Flags: NFTokenMintFlags.tfTransferable,
NFTokenTaxon: 0,
Issuer: 'r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ',
TransferFee: 1,
URI: '',
} as any
assert.throws(
() => validate(invalid),
ValidationError,
'NFTokenMint: URI must not be empty string',
)
})
it(`throws w/ URI not in hex format`, function () {
const invalid = {
TransactionType: 'NFTokenMint',