chore: rename test files (#2181)

This commit is contained in:
justinr1234
2023-01-06 14:04:36 -06:00
committed by GitHub
parent 9e74f94c44
commit 8abcfe4640
122 changed files with 49 additions and 50 deletions

View File

@@ -0,0 +1,95 @@
import { assert } from 'chai'
import { validate, ValidationError } from 'xrpl-local'
import { validateTicketCreate } from 'xrpl-local/models/transactions/ticketCreate'
/**
* TicketCreate Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('TicketCreate', function () {
let ticketCreate
beforeEach(function () {
ticketCreate = {
TransactionType: 'TicketCreate',
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
TicketCount: 150,
} as any
})
it('verifies valid TicketCreate', function () {
assert.doesNotThrow(() => validateTicketCreate(ticketCreate))
assert.doesNotThrow(() => validate(ticketCreate))
})
it('throws when TicketCount is missing', function () {
delete ticketCreate.TicketCount
assert.throws(
() => validateTicketCreate(ticketCreate),
ValidationError,
'TicketCreate: missing field TicketCount',
)
assert.throws(
() => validate(ticketCreate),
ValidationError,
'TicketCreate: missing field TicketCount',
)
})
it('throws when TicketCount is not a number', function () {
ticketCreate.TicketCount = '150'
assert.throws(
() => validateTicketCreate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be a number',
)
assert.throws(
() => validate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be a number',
)
})
it('throws when TicketCount is not an integer', function () {
ticketCreate.TicketCount = 12.5
assert.throws(
() => validateTicketCreate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
assert.throws(
() => validate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
})
it('throws when TicketCount is < 1', function () {
ticketCreate.TicketCount = 0
assert.throws(
() => validateTicketCreate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
assert.throws(
() => validate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
})
it('throws when TicketCount is > 250', function () {
ticketCreate.TicketCount = 251
assert.throws(
() => validateTicketCreate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
assert.throws(
() => validate(ticketCreate),
ValidationError,
'TicketCreate: TicketCount must be an integer from 1 to 250',
)
})
})