Add parseNFTokenID and tests (#1961)

* Add parseNFTokenID and tests

* Lint

* Move parseNFTokenID to utils

* Lint

* Move the NFTokenID into models

* Move NFTokenID type out of models

* Lint

* Remove extra type and lint
This commit is contained in:
Jackson Mills
2022-04-12 15:48:50 -07:00
committed by GitHub
parent 3b980d8be9
commit 587a3bbfa2
4 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { assert } from 'chai'
import { parseNFTokenID } from 'xrpl-local'
import { assertResultMatch } from '../testUtils'
describe('parseNFTokenID', function () {
it('decode a valid NFTokenID', function () {
const tokenID =
'000B0539C35B55AA096BA6D87A6E6C965A6534150DC56E5E12C5D09E0000000C'
const result = parseNFTokenID(tokenID)
const expected = {
TokenID: tokenID,
Flags: 11,
TransferFee: 1337,
Issuer: 'rJoxBSzpXhPtAuqFmqxQtGKjA13jUJWthE',
Taxon: 1337,
Sequence: 12,
}
assertResultMatch(result, expected)
})
it('fail when given invalid NFTokenID', function () {
assert.throws(() => {
parseNFTokenID('ABCD')
})
})
})