Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens committed Jan 25, 2021
1 parent f82810d commit bffc701
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/extensions/VotingBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ abstract contract VotingBase is ColonyExtension {

require(
stakerTotalAmount <= getInfluence(_motionId, msg.sender),
"voting-base-insufficient-rep"
"voting-base-insufficient-influence"
);
require(
stakerTotalAmount >= wmul(requiredStake, userMinStakeFraction) ||
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/voting-rep.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ contract("Voting Reputation", (accounts) => {

await checkErrorRevert(
voting.stakeMotion(motionId, 1, UINT256_MAX, YAY, REQUIRED_STAKE, user2Key, user2Value, user2Mask, user2Siblings, { from: USER2 }),
"voting-base-insufficient-rep"
"voting-base-insufficient-influence"
);
});

Expand Down
15 changes: 13 additions & 2 deletions test/extensions/voting-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,19 @@ contract("Voting Token", (accounts) => {
expect(expenditureSlot.claimDelay).to.be.zero;
});

it("cannot stake with insufficient reputation", async () => {
await checkErrorRevert(voting.stakeMotion(motionId, 1, UINT256_MAX, YAY, requiredStake, { from: USER2 }), "voting-base-insufficient-rep");
it("cannot stake with insufficient token balance", async () => {
const user3 = accounts[3];
const user3influence = WAD.divn(1000);

await token.mint(user3, user3influence);
await token.approve(tokenLocking.address, user3influence, { from: user3 });
await tokenLocking.deposit(token.address, user3influence, { from: user3 });
await colony.approveStake(voting.address, 1, user3influence, { from: user3 });

const totalSupply = await token.totalSupply();
requiredStake = totalSupply.divn(1000);

await checkErrorRevert(voting.stakeMotion(motionId, 1, UINT256_MAX, YAY, requiredStake, { from: user3 }), "voting-base-insufficient-influence");
});

it("cannot stake once time runs out", async () => {
Expand Down

0 comments on commit bffc701

Please sign in to comment.