fix revert claim test
This commit is contained in:
parent
c2ada23590
commit
bc37ab5686
@ -9,7 +9,6 @@ const Token = artifacts.require("Token.sol");
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const getContract = name => artifacts.require(name);
|
const getContract = name => artifacts.require(name);
|
||||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||||
|
|
||||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||||
|
|
||||||
const timeTravel = function(time){
|
const timeTravel = function(time){
|
||||||
@ -44,6 +43,16 @@ const mineBlock = function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getBlockNumber = function() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
web3.eth.getBlockNumber(async (err, res) => {
|
||||||
|
if (err || !res) return reject(err);
|
||||||
|
resolve(res);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
contract('Contribution app', (accounts) => {
|
contract('Contribution app', (accounts) => {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
let kernelBase, aclBase, daoFactory, r, dao, acl, contribution, token, contributor;
|
let kernelBase, aclBase, daoFactory, r, dao, acl, contribution, token, contributor;
|
||||||
@ -249,14 +258,22 @@ contract('Contribution app', (accounts) => {
|
|||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
before(async () =>{
|
before(async () =>{
|
||||||
|
//add contributor
|
||||||
|
let account = root;
|
||||||
|
let contributorHashDigest = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||||
|
let contributorHashFunction = 0;
|
||||||
|
let contributorHashSize = 0;
|
||||||
|
await contributor.addContributor(account, contributorHashDigest, contributorHashFunction, contributorHashSize);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
assert.equal(await contributor.addressExists(account), true);
|
||||||
|
|
||||||
|
//add contribution
|
||||||
let amount = 200;
|
let amount = 200;
|
||||||
let contributorId = 1;
|
let contributorId = await contributor.getContributorIdByAddress(root);
|
||||||
let hashDigest = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
let contributionHashDigest = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||||
let hashFunction = 1;
|
let contributionHashFunction = 1;
|
||||||
let hashSize = 1;
|
let contributionHashSize = 1;
|
||||||
|
await contribution.add(amount, contributorId.toNumber(), contributionHashDigest, contributionHashFunction, contributionHashSize, {from: root});
|
||||||
await contribution.add(amount, contributorId, hashDigest, hashFunction, hashSize, {from: root});
|
|
||||||
|
|
||||||
contributionId = await contribution.contributionsCount();
|
contributionId = await contribution.contributionsCount();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -268,10 +285,12 @@ contract('Contribution app', (accounts) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should revert when claim contribution before confirmation block", async () => {
|
it("should revert when claim contribution before confirmation block", async () => {
|
||||||
|
if(contributionId > 10) {
|
||||||
return assertRevert(async () => {
|
return assertRevert(async () => {
|
||||||
await contribution.claim(contributionId.toNumber(), {from: root});
|
await contribution.claim(contributionId.toNumber(), {from: root});
|
||||||
'contribution not confirmed yet';
|
'contribution not confirmed yet';
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("claim contribution", async () => {
|
it("claim contribution", async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user