-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 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,37 @@ | ||
const { ethers } = require('hardhat'); | ||
const { expect } = require('chai'); | ||
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); | ||
const { setup } = require('./setup'); | ||
|
||
const { parseEther } = ethers.utils; | ||
|
||
describe('addBudget', function () { | ||
it('should revert to update the budget if it is not done by governance', async function () { | ||
const fixture = await loadFixture(setup); | ||
const { ramm } = fixture.contracts; | ||
const { | ||
members: [member], | ||
} = fixture.accounts; | ||
|
||
const amount = parseEther('250'); | ||
|
||
await expect(ramm.connect(member).addBudget(amount)).to.be.revertedWith('Caller is not authorized to govern'); | ||
}); | ||
|
||
it('should update the config parameters', async function () { | ||
const fixture = await loadFixture(setup); | ||
const { ramm } = fixture.contracts; | ||
const { | ||
governanceContracts: [governance], | ||
} = fixture.accounts; | ||
|
||
const amount = parseEther('250'); | ||
const budgetBefore = await ramm.budget(); | ||
|
||
await ramm.connect(governance).addBudget(amount); | ||
|
||
const budgetAfter = await ramm.budget(); | ||
|
||
expect(budgetAfter).to.be.equal(budgetBefore.add(amount)); | ||
}); | ||
}); |