mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 08:35:49 +00:00
refactor: define typescript type for SetRegularKey transaction (#1548)
* refactor: define typescript type for SetRegularKey transaction
This commit is contained in:
committed by
Mayukha Vadari
parent
d324056203
commit
478e147ae0
42
test/models/setRegularKey.ts
Normal file
42
test/models/setRegularKey.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
import { verifySetRegularKey } from './../../src/models/transactions/setRegularKey'
|
||||
import { assert } from 'chai'
|
||||
|
||||
/**
|
||||
* SetRegularKey Transaction Verification Testing
|
||||
*
|
||||
* Providing runtime verification testing for each specific transaction type
|
||||
*/
|
||||
describe('SetRegularKey Transaction Verification', function () {
|
||||
let account
|
||||
|
||||
beforeEach(() => {
|
||||
account = {
|
||||
TransactionType : "SetRegularKey",
|
||||
Account : "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
Fee : "12",
|
||||
Flags : 0,
|
||||
RegularKey : "rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD"
|
||||
} as any
|
||||
})
|
||||
|
||||
it (`verifies valid SetRegularKey`, () => {
|
||||
assert.doesNotThrow(() => verifySetRegularKey(account))
|
||||
})
|
||||
|
||||
it (`verifies w/o SetRegularKey`, () => {
|
||||
account.RegularKey = undefined
|
||||
assert.doesNotThrow(() => verifySetRegularKey(account))
|
||||
})
|
||||
|
||||
it (`throws w/ invalid RegularKey`, () => {
|
||||
account.RegularKey = 12369846963
|
||||
|
||||
assert.throws(
|
||||
() => verifySetRegularKey(account),
|
||||
ValidationError,
|
||||
"SetRegularKey: RegularKey must be a string"
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user