Files
xahau.js/test/models/utils.ts
Omar Khan bec487cf71 refactor: Define PaymentTransaction model (#1542)
- Defines a TypeScript type for PaymentTransaction
- Provides an optional function to users for verifying a PaymentTransaction instance at runtime: verifyPaymentTransaction()
- Adds tests for verifyPaymentTransaction()
- Adds isFlagEnabled() util to be used for models
2021-10-04 14:10:08 -04:00

30 lines
691 B
TypeScript

import { isFlagEnabled } from '../../src/models/utils'
import { assert } from 'chai'
/**
* Utils Testing
*
* Provides tests for utils used in models
*/
describe('Models Utils', () => {
describe('isFlagEnabled', () => {
let flags
const flag1 = 0x00010000
const flag2 = 0x00020000
beforeEach(() => {
flags = 0x00000000
})
it('verifies a flag is enabled', () => {
flags += flag1 + flag2
assert.isTrue(isFlagEnabled(flags, flag1))
})
it('verifies a flag is not enabled', () => {
flags += flag2
assert.isFalse(isFlagEnabled(flags, flag1))
})
})
})