mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 16:45:49 +00:00
refactor: add verify() function (#1552)
* refactor: add verify() function
This commit is contained in:
committed by
Mayukha Vadari
parent
0d32071e0e
commit
148cac6f3f
@@ -1,8 +1,7 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
|
||||
import { verifyPaymentChannelCreate } from '../../src/models/transactions/paymentChannelCreate'
|
||||
import { verifyPaymentChannelCreate } from './../../src/models/transactions/paymentChannelCreate'
|
||||
import { assert } from 'chai'
|
||||
import { verify } from '../../src/models/transactions'
|
||||
|
||||
/**
|
||||
* PaymentChannelCreate Transaction Verification Testing.
|
||||
@@ -29,6 +28,7 @@ describe('PaymentChannelCreate', function () {
|
||||
|
||||
it(`verifies valid PaymentChannelCreate`, function () {
|
||||
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel))
|
||||
assert.doesNotThrow(() => verify(channel))
|
||||
})
|
||||
|
||||
it(`verifies valid PaymentChannelCreate w/o optional`, function () {
|
||||
@@ -37,6 +37,7 @@ describe('PaymentChannelCreate', function () {
|
||||
delete channel.SourceTag
|
||||
|
||||
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel))
|
||||
assert.doesNotThrow(() => verify(channel))
|
||||
})
|
||||
|
||||
it(`missing Amount`, function () {
|
||||
@@ -47,6 +48,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing Amount',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing Amount',
|
||||
)
|
||||
})
|
||||
|
||||
it(`missing Destination`, function () {
|
||||
@@ -57,6 +63,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing Destination',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing Destination',
|
||||
)
|
||||
})
|
||||
|
||||
it(`missing SettleDelay`, function () {
|
||||
@@ -67,6 +78,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing SettleDelay',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing SettleDelay',
|
||||
)
|
||||
})
|
||||
|
||||
it(`missing PublicKey`, function () {
|
||||
@@ -77,6 +93,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing PublicKey',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: missing PublicKey',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid Amount`, function () {
|
||||
@@ -87,6 +108,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: Amount must be a string',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: Amount must be a string',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid Destination`, function () {
|
||||
@@ -97,6 +123,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: Destination must be a string',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: Destination must be a string',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid SettleDelay`, function () {
|
||||
@@ -107,6 +138,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: SettleDelay must be a number',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: SettleDelay must be a number',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid PublicKey`, function () {
|
||||
@@ -117,6 +153,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: PublicKey must be a string',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: PublicKey must be a string',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid DestinationTag`, function () {
|
||||
@@ -127,6 +168,11 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: DestinationTag must be a number',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: DestinationTag must be a number',
|
||||
)
|
||||
})
|
||||
|
||||
it(`invalid CancelAfter`, function () {
|
||||
@@ -137,5 +183,10 @@ describe('PaymentChannelCreate', function () {
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: CancelAfter must be a number',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(channel),
|
||||
ValidationError,
|
||||
'PaymentChannelCreate: CancelAfter must be a number',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user