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 { validateEscrowCreate, validate } from 'xrpl-local'
import { ValidationError } from 'xrpl-local/common/errors'
import { verify } from '../../src/models/transactions'
import { verifyEscrowCreate } from '../../src/models/transactions/escrowCreate'
/**
* EscrowCreate Transaction Verification Testing.
*
@@ -29,20 +27,20 @@ describe('EscrowCreate', function () {
})
it(`verifies valid EscrowCreate`, function () {
assert.doesNotThrow(() => verifyEscrowCreate(escrow))
assert.doesNotThrow(() => verify(escrow))
assert.doesNotThrow(() => validateEscrowCreate(escrow))
assert.doesNotThrow(() => validate(escrow))
})
it(`Missing amount`, function () {
delete escrow.Amount
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: missing field Amount',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: missing field Amount',
)
@@ -52,12 +50,12 @@ describe('EscrowCreate', function () {
delete escrow.Destination
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: missing field Destination',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: missing field Destination',
)
@@ -67,12 +65,12 @@ describe('EscrowCreate', function () {
escrow.Destination = 10
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: Destination must be a string',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: Destination must be a string',
)
@@ -82,12 +80,12 @@ describe('EscrowCreate', function () {
escrow.Amount = 1000
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: Amount must be a string',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: Amount must be a string',
)
@@ -97,12 +95,12 @@ describe('EscrowCreate', function () {
escrow.CancelAfter = '100'
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: CancelAfter must be a number',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: CancelAfter must be a number',
)
@@ -112,7 +110,7 @@ describe('EscrowCreate', function () {
escrow.FinishAfter = '1000'
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: FinishAfter must be a number',
)
@@ -122,12 +120,12 @@ describe('EscrowCreate', function () {
escrow.Condition = 0x141243
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: Condition must be a string',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: Condition must be a string',
)
@@ -137,12 +135,12 @@ describe('EscrowCreate', function () {
escrow.DestinationTag = '100'
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: DestinationTag must be a number',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: DestinationTag must be a number',
)
@@ -153,12 +151,12 @@ describe('EscrowCreate', function () {
delete escrow.FinishAfter
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: Either CancelAfter or FinishAfter must be specified',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: Either CancelAfter or FinishAfter must be specified',
)
@@ -169,12 +167,12 @@ describe('EscrowCreate', function () {
delete escrow.FinishAfter
assert.throws(
() => verifyEscrowCreate(escrow),
() => validateEscrowCreate(escrow),
ValidationError,
'EscrowCreate: Either Condition or FinishAfter must be specified',
)
assert.throws(
() => verify(escrow),
() => validate(escrow),
ValidationError,
'EscrowCreate: Either Condition or FinishAfter must be specified',
)