-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add token controller burnFrom unit tests
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { expect } = require('chai'); | ||
const { parseEther } = require('ethers/lib/utils'); | ||
|
||
describe('burnFrom', function () { | ||
it('reverts if caller is not an internal contract', async function () { | ||
const { tokenController } = this.contracts; | ||
const [member1] = this.accounts.members; | ||
|
||
const amount = parseEther('10'); | ||
await expect(tokenController.connect(member1).burnFrom(member1.address, amount)).to.be.revertedWith( | ||
'Caller is not an internal contract', | ||
); | ||
}); | ||
|
||
it('burns nxm from member', async function () { | ||
const { tokenController, nxm } = this.contracts; | ||
const [internalContract] = this.accounts.internalContracts; | ||
const [member1] = this.accounts.members; | ||
|
||
const initialBalanceMember1 = await nxm.balanceOf(member1.address); | ||
|
||
const amount = parseEther('10'); | ||
await tokenController.connect(internalContract).burnFrom(member1.address, amount); | ||
|
||
const balanceMember1 = await nxm.balanceOf(member1.address); | ||
|
||
expect(balanceMember1).to.equal(initialBalanceMember1.sub(amount)); | ||
}); | ||
}); |
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