fix: renames verify... methods to validate... (#1624)

* rename verify -> validate

* fix imports

* run eslint --fix on test/
This commit is contained in:
Mayukha Vadari
2021-09-16 21:14:22 -04:00
parent eb0445817e
commit 13c52859eb
51 changed files with 423 additions and 461 deletions

View File

@@ -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",
)