-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: view methods for bond contract
Refs: #99
- Loading branch information
1 parent
5f23ce5
commit d7eb098
Showing
7 changed files
with
207 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { BondContract, Compensation, State } from '../src'; | ||
import { Bond } from '../src'; | ||
|
||
describe('Bond test', () => { | ||
test('#test view methods', async () => { | ||
const bondContract = new BondContract('devnet'); | ||
|
||
const bondPaymentToken = await bondContract.viewBondPaymentToken(); | ||
|
||
expect(typeof bondPaymentToken).toBe('string'); | ||
|
||
const lockPeriodsWithBonds = await bondContract.viewLockPeriodsWithBonds(); | ||
|
||
expect(typeof lockPeriodsWithBonds).toBe('object'); | ||
|
||
const contractState = await bondContract.viewContractState(); | ||
|
||
expect(Object.values(State).includes(contractState)).toBe(true); | ||
|
||
const acceptedCallers = await bondContract.viewAcceptedCallers(); | ||
|
||
expect(typeof acceptedCallers).toBe('object'); | ||
|
||
const bond: Bond[] = await bondContract.viewBonds([1]); | ||
|
||
expect(bond).toMatchObject<Bond>; | ||
|
||
const sameBond: Bond[] = await bondContract.viewBonds( | ||
['NEWDNFT-3a8caa'], | ||
[8] | ||
); | ||
|
||
expect(sameBond).toMatchObject<Bond[]>; | ||
|
||
const sameBond2: Bond[] = await bondContract.viewBonds([ | ||
'NEWDNFT-3a8caa-08' | ||
]); | ||
expect(sameBond2).toMatchObject<Bond[]>; | ||
|
||
const compensation: Compensation = await bondContract.viewCompensation( | ||
'NEWDNFT-3a8caa', | ||
8 | ||
); | ||
|
||
expect(compensation).toMatchObject<Compensation>; | ||
}); | ||
}); |