Skip to content

Commit 991a1d2

Browse files
authored
Add more unit test for DynamicNFT (#2892)
* Add more unit test for DynamicNFT * resolve comment
1 parent 23d26c8 commit 991a1d2

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

packages/ripple-binary-codec/HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
### Added
1313
* Support for the Price Oracles amendment (XLS-47).
14-
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint`
14+
* Support for the `DynamicNFT` amendment (XLS-46)
1515

1616
### Fixed
1717
* Better error handling/error messages for serialization/deserialization errors.

packages/xrpl/HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
1717
* New `MPTAmount` type support for `Payment` and `Clawback` transactions
1818
* `parseTransactionFlags` as a utility function in the xrpl package to streamline transactions flags-to-map conversion
1919
* Support for XLS-70d (Credentials)
20-
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint`
20+
* Support for the `DynamicNFT` amendment (XLS-46)
2121

2222
### Fixed
2323
* `TransactionStream` model supports APIv2

packages/xrpl/src/models/transactions/NFTokenModify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface NFTokenModify extends BaseTransaction {
3838
* convert this field to the proper encoding.
3939
*
4040
* This field must not be an empty string. Omit it from the transaction or
41-
* set to `undefined` value if you do not use it.
41+
* set to `null` if you do not use it.
4242
*/
4343
URI?: string | null
4444
}

packages/xrpl/test/models/NFTokenModify.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,38 @@ describe('NFTokenModify', function () {
3838
'NFTokenModify: missing field NFTokenID',
3939
)
4040
})
41+
42+
it(`throws w/ URI being an empty string`, function () {
43+
const invalid = {
44+
TransactionType: 'NFTokenModify',
45+
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
46+
NFTokenID: TOKEN_ID,
47+
Fee: '5000000',
48+
Sequence: 2470665,
49+
URI: '',
50+
} as any
51+
52+
assert.throws(
53+
() => validate(invalid),
54+
ValidationError,
55+
'NFTokenModify: URI must not be empty string',
56+
)
57+
})
58+
59+
it(`throws w/ URI not in hex format`, function () {
60+
const invalid = {
61+
TransactionType: 'NFTokenModify',
62+
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
63+
NFTokenID: TOKEN_ID,
64+
Fee: '5000000',
65+
Sequence: 2470665,
66+
URI: '--',
67+
} as any
68+
69+
assert.throws(
70+
() => validate(invalid),
71+
ValidationError,
72+
'NFTokenModify: URI must be in hex format',
73+
)
74+
})
4175
})

0 commit comments

Comments
 (0)