mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +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 { verifyTicketCreate } from '../../src/models/transactions/ticketCreate'
|
||||
import { verifyTicketCreate } from './../../src/models/transactions/ticketCreate'
|
||||
import { assert } from 'chai'
|
||||
import { verify } from '../../src/models/transactions'
|
||||
|
||||
/**
|
||||
* TicketCreate Transaction Verification Testing.
|
||||
@@ -22,6 +21,7 @@ describe('TicketCreate', function () {
|
||||
|
||||
it('verifies valid TicketCreate', function () {
|
||||
assert.doesNotThrow(() => verifyTicketCreate(ticketCreate))
|
||||
assert.doesNotThrow(() => verify(ticketCreate))
|
||||
})
|
||||
|
||||
it('throws when TicketCount is missing', function () {
|
||||
@@ -31,6 +31,11 @@ describe('TicketCreate', function () {
|
||||
ValidationError,
|
||||
'TicketCreate: missing field TicketCount',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: missing field TicketCount',
|
||||
)
|
||||
})
|
||||
|
||||
it('throws when TicketCount is not a number', function () {
|
||||
@@ -40,6 +45,11 @@ describe('TicketCreate', function () {
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be a number',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be a number',
|
||||
)
|
||||
})
|
||||
|
||||
it('throws when TicketCount is not an integer', function () {
|
||||
@@ -49,6 +59,11 @@ describe('TicketCreate', function () {
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
})
|
||||
|
||||
it('throws when TicketCount is < 1', function () {
|
||||
@@ -58,6 +73,11 @@ describe('TicketCreate', function () {
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
})
|
||||
|
||||
it('throws when TicketCount is > 250', function () {
|
||||
@@ -67,5 +87,10 @@ describe('TicketCreate', function () {
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user