mirror of
				https://github.com/Xahau/xahau.js.git
				synced 2025-11-04 04:55:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { assert } from 'chai'
 | 
						|
 | 
						|
import { validate, ValidationError } from '../../src'
 | 
						|
import { validateSetRegularKey } from '../../src/models/transactions/setRegularKey'
 | 
						|
 | 
						|
/**
 | 
						|
 * SetRegularKey Transaction Verification Testing.
 | 
						|
 *
 | 
						|
 * Providing runtime verification testing for each specific transaction type.
 | 
						|
 */
 | 
						|
describe('SetRegularKey', function () {
 | 
						|
  let account
 | 
						|
 | 
						|
  beforeEach(function () {
 | 
						|
    account = {
 | 
						|
      TransactionType: 'SetRegularKey',
 | 
						|
      Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
 | 
						|
      Fee: '12',
 | 
						|
      NetworkID: 21338,
 | 
						|
      Flags: 0,
 | 
						|
      RegularKey: 'rAR8rR8sUkBoCZFawhkWzY4Y5YoyuznwD',
 | 
						|
    } as any
 | 
						|
  })
 | 
						|
 | 
						|
  it(`verifies valid SetRegularKey`, function () {
 | 
						|
    assert.doesNotThrow(() => validateSetRegularKey(account))
 | 
						|
    assert.doesNotThrow(() => validate(account))
 | 
						|
  })
 | 
						|
 | 
						|
  it(`verifies w/o SetRegularKey`, function () {
 | 
						|
    account.RegularKey = undefined
 | 
						|
    assert.doesNotThrow(() => validateSetRegularKey(account))
 | 
						|
    assert.doesNotThrow(() => validate(account))
 | 
						|
  })
 | 
						|
 | 
						|
  it(`throws w/ invalid RegularKey`, function () {
 | 
						|
    account.RegularKey = 12369846963
 | 
						|
 | 
						|
    assert.throws(
 | 
						|
      () => validateSetRegularKey(account),
 | 
						|
      ValidationError,
 | 
						|
      'SetRegularKey: RegularKey must be a string',
 | 
						|
    )
 | 
						|
    assert.throws(
 | 
						|
      () => validate(account),
 | 
						|
      ValidationError,
 | 
						|
      'SetRegularKey: RegularKey must be a string',
 | 
						|
    )
 | 
						|
  })
 | 
						|
})
 |