mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-28 08:05:51 +00:00
refactor: add verify() function (#1552)
* refactor: add verify() function
This commit is contained in:
committed by
Mayukha Vadari
parent
9439a6f505
commit
09522e9ce2
@@ -1,8 +1,7 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
|
||||
import { verifyOfferCreate } from '../../src/models/transactions/offerCreate'
|
||||
import { verifyOfferCreate } from './../../src/models/transactions/offerCreate'
|
||||
import { assert } from 'chai'
|
||||
import { verify } from '../../src/models/transactions'
|
||||
|
||||
/**
|
||||
* OfferCreate Transaction Verification Testing.
|
||||
@@ -33,6 +32,7 @@ describe('OfferCreate', function () {
|
||||
} as any
|
||||
|
||||
assert.doesNotThrow(() => verifyOfferCreate(offer))
|
||||
assert.doesNotThrow(() => verify(offer))
|
||||
|
||||
const offer2 = {
|
||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||
@@ -54,6 +54,7 @@ describe('OfferCreate', function () {
|
||||
} as any
|
||||
|
||||
assert.doesNotThrow(() => verifyOfferCreate(offer2))
|
||||
assert.doesNotThrow(() => verify(offer2))
|
||||
|
||||
const offer3 = {
|
||||
Account: 'r3rhWeE31Jt5sWmi4QiGLMZnY3ENgqw96W',
|
||||
@@ -79,6 +80,7 @@ describe('OfferCreate', function () {
|
||||
} as any
|
||||
|
||||
assert.doesNotThrow(() => verifyOfferCreate(offer3))
|
||||
assert.doesNotThrow(() => verify(offer3))
|
||||
})
|
||||
|
||||
it(`throws w/ invalid Expiration`, function () {
|
||||
@@ -107,6 +109,11 @@ describe('OfferCreate', function () {
|
||||
ValidationError,
|
||||
'OfferCreate: invalid Expiration',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(offer),
|
||||
ValidationError,
|
||||
'OfferCreate: invalid Expiration',
|
||||
)
|
||||
})
|
||||
|
||||
it(`throws w/ invalid OfferSequence`, function () {
|
||||
@@ -135,6 +142,11 @@ describe('OfferCreate', function () {
|
||||
ValidationError,
|
||||
'OfferCreate: invalid OfferSequence',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(offer),
|
||||
ValidationError,
|
||||
'OfferCreate: invalid OfferSequence',
|
||||
)
|
||||
})
|
||||
|
||||
it(`throws w/ invalid TakerPays`, function () {
|
||||
@@ -159,6 +171,11 @@ describe('OfferCreate', function () {
|
||||
ValidationError,
|
||||
'OfferCreate: invalid TakerPays',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(offer),
|
||||
ValidationError,
|
||||
'OfferCreate: invalid TakerPays',
|
||||
)
|
||||
})
|
||||
|
||||
it(`throws w/ invalid TakerGets`, function () {
|
||||
@@ -187,5 +204,10 @@ describe('OfferCreate', function () {
|
||||
ValidationError,
|
||||
'OfferCreate: invalid TakerGets',
|
||||
)
|
||||
assert.throws(
|
||||
() => verify(offer),
|
||||
ValidationError,
|
||||
'OfferCreate: invalid TakerGets',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user