Skip to content

Commit

Permalink
add XChainCreateClaimID model tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Jul 31, 2022
1 parent c71d111 commit 02c1185
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions packages/xrpl/test/models/XChainCreateClaimID.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { assert } from 'chai'
import { validate, ValidationError } from 'xrpl-local'
import { validateXChainCreateClaimID } from 'xrpl-local/models/transactions/XChainCreateClaimID'

/**
* XChainCreateClaimID Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type.
*/
describe('XChainCreateClaimID', function () {
let tx

beforeEach(function () {
tx = {
Account: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
XChainBridge: {
LockingChainDoor: 'rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL',
LockingChainIssue: 'XRP',
IssuingChainDoor: 'r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV',
IssuingChainIssue: 'XRP',
},
Fee: '10',
Flags: 2147483648,
OtherChainAccount: 'rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL',
Sequence: 1,
SignatureReward: '10000',
SigningPubKey:
'0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020',
TransactionType: 'XChainCreateClaimID',
TxnSignature:
'30440220247B20A1B9C48E21A374CB9B3E1FE2A7C528151868DF8D307E9FBE15237E531A02207C20C092DDCC525E583EF4AB7CB91E862A6DED19426997D3F0A2C84E2BE8C5DD',
}
})

it(`verifies valid XChainCreateClaimID`, function () {
assert.doesNotThrow(() => validateXChainCreateClaimID(tx))
assert.doesNotThrow(() => validate(tx))
})

it(`throws w/ missing XChainBridge`, function () {
delete tx.XChainBridge

assert.throws(
() => validateXChainCreateClaimID(tx),
ValidationError,
'XChainCreateClaimID: missing field XChainBridge',
)
assert.throws(
() => validate(tx),
ValidationError,
'XChainCreateClaimID: missing field XChainBridge',
)
})

it(`throws w/ missing SignatureReward`, function () {
delete tx.SignatureReward

assert.throws(
() => validateXChainCreateClaimID(tx),
ValidationError,
'XChainCreateClaimID: missing field SignatureReward',
)
assert.throws(
() => validate(tx),
ValidationError,
'XChainCreateClaimID: missing field SignatureReward',
)
})

it(`throws w/ missing OtherChainAccount`, function () {
delete tx.OtherChainAccount

assert.throws(
() => validateXChainCreateClaimID(tx),
ValidationError,
'XChainCreateClaimID: missing field OtherChainAccount',
)
assert.throws(
() => validate(tx),
ValidationError,
'XChainCreateClaimID: missing field OtherChainAccount',
)
})
})

0 comments on commit 02c1185

Please sign in to comment.