Skip to content

Commit

Permalink
Add unit tests for addBudget
Browse files Browse the repository at this point in the history
  • Loading branch information
MilGard91 committed Aug 1, 2023
1 parent 3c3a033 commit 47d4f28
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/unit/Ramm/addBudget.js
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));
});
});

0 comments on commit 47d4f28

Please sign in to comment.