mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 17:45:49 +00:00
fix: renames verify... methods to validate... (#1624)
* rename verify -> validate * fix imports * run eslint --fix on test/
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { validateDepositPreauth, validate } from 'xrpl-local'
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
|
||||
import { verify } from '../../src/models/transactions'
|
||||
import { verifyDepositPreauth } from '../../src/models/transactions/depositPreauth'
|
||||
|
||||
/**
|
||||
* DepositPreauth Transaction Verification Testing.
|
||||
*
|
||||
@@ -22,26 +20,26 @@ describe('DepositPreauth', function () {
|
||||
|
||||
it('verifies valid DepositPreauth when only Authorize is provided', function () {
|
||||
depositPreauth.Authorize = 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW'
|
||||
assert.doesNotThrow(() => verifyDepositPreauth(depositPreauth))
|
||||
assert.doesNotThrow(() => verify(depositPreauth))
|
||||
assert.doesNotThrow(() => validateDepositPreauth(depositPreauth))
|
||||
assert.doesNotThrow(() => validate(depositPreauth))
|
||||
})
|
||||
|
||||
it('verifies valid DepositPreauth when only Unauthorize is provided', function () {
|
||||
depositPreauth.Unauthorize = 'raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n'
|
||||
assert.doesNotThrow(() => verifyDepositPreauth(depositPreauth))
|
||||
assert.doesNotThrow(() => verify(depositPreauth))
|
||||
assert.doesNotThrow(() => validateDepositPreauth(depositPreauth))
|
||||
assert.doesNotThrow(() => validate(depositPreauth))
|
||||
})
|
||||
|
||||
it('throws when both Authorize and Unauthorize are provided', function () {
|
||||
depositPreauth.Authorize = 'rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW'
|
||||
depositPreauth.Unauthorize = 'raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n'
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
"DepositPreauth: can't provide both Authorize and Unauthorize fields",
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(depositPreauth),
|
||||
() => validate(depositPreauth),
|
||||
ValidationError,
|
||||
"DepositPreauth: can't provide both Authorize and Unauthorize fields",
|
||||
)
|
||||
@@ -49,12 +47,12 @@ describe('DepositPreauth', function () {
|
||||
|
||||
it('throws when neither Authorize nor Unauthorize are provided', function () {
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: must provide either Authorize or Unauthorize field',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(depositPreauth),
|
||||
() => validate(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: must provide either Authorize or Unauthorize field',
|
||||
)
|
||||
@@ -63,12 +61,12 @@ describe('DepositPreauth', function () {
|
||||
it('throws when Authorize is not a string', function () {
|
||||
depositPreauth.Authorize = 1234
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: Authorize must be a string',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(depositPreauth),
|
||||
() => validate(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: Authorize must be a string',
|
||||
)
|
||||
@@ -77,7 +75,7 @@ describe('DepositPreauth', function () {
|
||||
it('throws when an Account attempts to preauthorize its own address', function () {
|
||||
depositPreauth.Authorize = depositPreauth.Account
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
"DepositPreauth: Account can't preauthorize its own address",
|
||||
)
|
||||
@@ -86,12 +84,12 @@ describe('DepositPreauth', function () {
|
||||
it('throws when Unauthorize is not a string', function () {
|
||||
depositPreauth.Unauthorize = 1234
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: Unauthorize must be a string',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(depositPreauth),
|
||||
() => validate(depositPreauth),
|
||||
ValidationError,
|
||||
'DepositPreauth: Unauthorize must be a string',
|
||||
)
|
||||
@@ -100,12 +98,12 @@ describe('DepositPreauth', function () {
|
||||
it('throws when an Account attempts to unauthorize its own address', function () {
|
||||
depositPreauth.Unauthorize = depositPreauth.Account
|
||||
assert.throws(
|
||||
() => verifyDepositPreauth(depositPreauth),
|
||||
() => validateDepositPreauth(depositPreauth),
|
||||
ValidationError,
|
||||
"DepositPreauth: Account can't unauthorize its own address",
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(depositPreauth),
|
||||
() => validate(depositPreauth),
|
||||
ValidationError,
|
||||
"DepositPreauth: Account can't unauthorize its own address",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user