refactor: add verify() function (#1552)

* refactor: add verify() function
This commit is contained in:
Mukul Jangid
2021-09-13 11:31:29 -04:00
committed by Mayukha Vadari
parent 0d32071e0e
commit 148cac6f3f
21 changed files with 732 additions and 103 deletions

View File

@@ -1,7 +1,7 @@
import { verifyEscrowCancel } from './../../src/models/transactions/escrowCancel'
import { assert } from 'chai'
import { ValidationError } from '../../src/common/errors'
import { verifyEscrowCancel } from '../../src/models/transactions/escrowCancel'
import { verify } from '../../src/models/transactions'
/**
* Transaction Verification Testing.
@@ -22,6 +22,7 @@ describe('EscrowCancel', function () {
it(`Valid EscrowCancel`, function () {
assert.doesNotThrow(() => verifyEscrowCancel(cancel))
assert.doesNotThrow(() => verify(cancel))
})
it(`Invalid EscrowCancel missing owner`, function () {
@@ -32,6 +33,11 @@ describe('EscrowCancel', function () {
ValidationError,
'EscrowCancel: missing Owner',
)
assert.throws(
() => verify(cancel),
ValidationError,
'EscrowCancel: missing Owner',
)
})
it(`Invalid EscrowCancel missing offerSequence`, function () {
@@ -42,6 +48,11 @@ describe('EscrowCancel', function () {
ValidationError,
'EscrowCancel: missing OfferSequence',
)
assert.throws(
() => verify(cancel),
ValidationError,
'EscrowCancel: missing OfferSequence',
)
})
it(`Invalid OfferSequence`, function () {
@@ -52,6 +63,11 @@ describe('EscrowCancel', function () {
ValidationError,
'EscrowCancel: Owner must be a string',
)
assert.throws(
() => verify(cancel),
ValidationError,
'EscrowCancel: Owner must be a string',
)
})
it(`Invalid owner`, function () {
@@ -62,5 +78,10 @@ describe('EscrowCancel', function () {
ValidationError,
'EscrowCancel: OfferSequence must be a number',
)
assert.throws(
() => verify(cancel),
ValidationError,
'EscrowCancel: OfferSequence must be a number',
)
})
})