Add more unit test for DynamicNFT (#2892)

* Add more unit test for DynamicNFT

* resolve comment
This commit is contained in:
yinyiqian1
2025-02-04 22:56:01 -05:00
committed by GitHub
parent 23d26c8c2e
commit 991a1d29a4
4 changed files with 37 additions and 3 deletions

View File

@@ -11,7 +11,7 @@
### Added ### Added
* Support for the Price Oracles amendment (XLS-47). * Support for the Price Oracles amendment (XLS-47).
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint` * Support for the `DynamicNFT` amendment (XLS-46)
### Fixed ### Fixed
* Better error handling/error messages for serialization/deserialization errors. * Better error handling/error messages for serialization/deserialization errors.

View File

@@ -17,7 +17,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
* New `MPTAmount` type support for `Payment` and `Clawback` transactions * New `MPTAmount` type support for `Payment` and `Clawback` transactions
* `parseTransactionFlags` as a utility function in the xrpl package to streamline transactions flags-to-map conversion * `parseTransactionFlags` as a utility function in the xrpl package to streamline transactions flags-to-map conversion
* Support for XLS-70d (Credentials) * Support for XLS-70d (Credentials)
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint` * Support for the `DynamicNFT` amendment (XLS-46)
### Fixed ### Fixed
* `TransactionStream` model supports APIv2 * `TransactionStream` model supports APIv2

View File

@@ -38,7 +38,7 @@ export interface NFTokenModify extends BaseTransaction {
* convert this field to the proper encoding. * convert this field to the proper encoding.
* *
* This field must not be an empty string. Omit it from the transaction or * This field must not be an empty string. Omit it from the transaction or
* set to `undefined` value if you do not use it. * set to `null` if you do not use it.
*/ */
URI?: string | null URI?: string | null
} }

View File

@@ -38,4 +38,38 @@ describe('NFTokenModify', function () {
'NFTokenModify: missing field NFTokenID', 'NFTokenModify: missing field NFTokenID',
) )
}) })
it(`throws w/ URI being an empty string`, function () {
const invalid = {
TransactionType: 'NFTokenModify',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
NFTokenID: TOKEN_ID,
Fee: '5000000',
Sequence: 2470665,
URI: '',
} as any
assert.throws(
() => validate(invalid),
ValidationError,
'NFTokenModify: URI must not be empty string',
)
})
it(`throws w/ URI not in hex format`, function () {
const invalid = {
TransactionType: 'NFTokenModify',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
NFTokenID: TOKEN_ID,
Fee: '5000000',
Sequence: 2470665,
URI: '--',
} as any
assert.throws(
() => validate(invalid),
ValidationError,
'NFTokenModify: URI must be in hex format',
)
})
}) })