Skip to content

Commit

Permalink
Add more unit test for DynamicNFT (#2892)
Browse files Browse the repository at this point in the history
* Add more unit test for DynamicNFT

* resolve comment
  • Loading branch information
yinyiqian1 authored Feb 5, 2025
1 parent 23d26c8 commit 991a1d2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ripple-binary-codec/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

### Added
* 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
* Better error handling/error messages for serialization/deserialization errors.
Expand Down
2 changes: 1 addition & 1 deletion packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* `parseTransactionFlags` as a utility function in the xrpl package to streamline transactions flags-to-map conversion
* Support for XLS-70d (Credentials)
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint`
* Support for the `DynamicNFT` amendment (XLS-46)

### Fixed
* `TransactionStream` model supports APIv2
Expand Down
2 changes: 1 addition & 1 deletion packages/xrpl/src/models/transactions/NFTokenModify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface NFTokenModify extends BaseTransaction {
* convert this field to the proper encoding.
*
* 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
}
Expand Down
34 changes: 34 additions & 0 deletions packages/xrpl/test/models/NFTokenModify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,38 @@ describe('NFTokenModify', function () {
'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',
)
})
})

0 comments on commit 991a1d2

Please sign in to comment.