mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
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
This commit is contained in:
committed by
Mayukha Vadari
parent
c1edab547a
commit
bec487cf71
29
test/models/utils.ts
Normal file
29
test/models/utils.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
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))
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user