mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
feat: Add parseAccountRootFlags (#1699)
* Add parseAccountRootFlags and interface * Add tests for parseAccountRootFlags
This commit is contained in:
@@ -12,8 +12,11 @@ import {
|
||||
TrustSet,
|
||||
TrustSetFlags,
|
||||
} from 'xrpl-local'
|
||||
import { AccountRootFlags } from 'xrpl-local/models/ledger'
|
||||
import { isFlagEnabled } from 'xrpl-local/models/utils'
|
||||
import setTransactionFlagsToNumber from 'xrpl-local/models/utils/flags'
|
||||
import setTransactionFlagsToNumber, {
|
||||
parseAccountRootFlags,
|
||||
} from 'xrpl-local/models/utils/flags'
|
||||
|
||||
/**
|
||||
* Utils Testing.
|
||||
@@ -146,5 +149,46 @@ describe('Models Utils', function () {
|
||||
setTransactionFlagsToNumber(tx)
|
||||
assert.strictEqual(tx.Flags, 0)
|
||||
})
|
||||
|
||||
it('parseAccountRootFlags all enabled', function () {
|
||||
const accountRootFlags =
|
||||
AccountRootFlags.lsfDefaultRipple |
|
||||
AccountRootFlags.lsfDepositAuth |
|
||||
AccountRootFlags.lsfDisableMaster |
|
||||
AccountRootFlags.lsfDisallowXRP |
|
||||
AccountRootFlags.lsfGlobalFreeze |
|
||||
AccountRootFlags.lsfNoFreeze |
|
||||
AccountRootFlags.lsfPasswordSpent |
|
||||
AccountRootFlags.lsfRequireAuth |
|
||||
AccountRootFlags.lsfRequireDestTag
|
||||
|
||||
const parsed = parseAccountRootFlags(accountRootFlags)
|
||||
|
||||
assert.isTrue(
|
||||
parsed.lsfDefaultRipple &&
|
||||
parsed.lsfDepositAuth &&
|
||||
parsed.lsfDisableMaster &&
|
||||
parsed.lsfDisallowXRP &&
|
||||
parsed.lsfGlobalFreeze &&
|
||||
parsed.lsfNoFreeze &&
|
||||
parsed.lsfPasswordSpent &&
|
||||
parsed.lsfRequireAuth &&
|
||||
parsed.lsfRequireDestTag,
|
||||
)
|
||||
})
|
||||
|
||||
it('parseAccountFlags all false', function () {
|
||||
const parsed = parseAccountRootFlags(0)
|
||||
|
||||
assert.isUndefined(parsed.lsfDefaultRipple)
|
||||
assert.isUndefined(parsed.lsfDepositAuth)
|
||||
assert.isUndefined(parsed.lsfDisableMaster)
|
||||
assert.isUndefined(parsed.lsfDisallowXRP)
|
||||
assert.isUndefined(parsed.lsfGlobalFreeze)
|
||||
assert.isUndefined(parsed.lsfNoFreeze)
|
||||
assert.isUndefined(parsed.lsfPasswordSpent)
|
||||
assert.isUndefined(parsed.lsfRequireAuth)
|
||||
assert.isUndefined(parsed.lsfRequireDestTag)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user