[WIP] Solidity contracts tests #106
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "tests/contracts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Unit tests for Kredits smart contracts
@haythem96 pretty cool to see how to test the contracts. I'm wondering why the
pull upstream master
commit reverts the pagination changes? I guess you need to rebase/merge master again...for what this unused variable ?
@haythem96 you mean
root
? I missed that in this commit:766463b57b (diff-b24176ed2ec209da948c7ef4f480abe1L36)
but the kit is still calling the function like that.
This doesn't actually check for an updated hash afaics.
yup...solved in this commit
@ -0,0 +96,4 @@
{ from: root }
);
//acl.grantPermission(contribution, token, await token.MINT_TOKEN_ROLE(), {from: root});
I have a problem here granting the mint token permission to the contribution app...
@ -0,0 +2,4 @@
// eslint-disable-next-line no-undef
const Proposal = artifacts.require("Proposal.sol");
const { Contributor, getContributorContract } = require("../../contributor/artifacts");
idk why I have an error here importing other apps contracts?
@ -0,0 +96,4 @@
{ from: root }
);
//acl.grantPermission(contribution, token, await token.MINT_TOKEN_ROLE(), {from: root});
what do you mean? what's the error?
@ -0,0 +2,4 @@
// eslint-disable-next-line no-undef
const Proposal = artifacts.require("Proposal.sol");
const { Contributor, getContributorContract } = require("../../contributor/artifacts");
looks to me like
artifacts
might not defined in the contributor/artifacts.js file.artifacts.require('Contributor')
does not work here? because the proposal app does not know about the Contributor.sol?from where is truffle loading the contracts?
@ -0,0 +96,4 @@
{ from: root }
);
//acl.grantPermission(contribution, token, await token.MINT_TOKEN_ROLE(), {from: root});
a revert...
@ -0,0 +2,4 @@
// eslint-disable-next-line no-undef
const Proposal = artifacts.require("Proposal.sol");
const { Contributor, getContributorContract } = require("../../contributor/artifacts");
I did the same with the Contribution app to access to the Token app contracts, and it worked...
If I understand correctly
artifacts.require('Contributor.sol')
in Contributor app should b able to access that contract inside that app contracts folder... or no ?@haythem96 You should run
npm run lint:wrapper --fix
andnpm run lint:contract-tests --fix
to get the fixable lint errors fixed. After that see what lint errors are left and fix them by hand.I did that...had some issue with the lint rules(e.g in the contracts test it show
'artifacts' is not defined
or'before' is not defined
... so I just disabled some rules in the tests filesContributor app tests works... still have issue with Contribution app, the
getTokenContract()
always returnaddress(0)
in the testsThis is turning into quite the monolithic monster pull request imo.
@haythem96 You think we can split this up, so it's easier to review, merge, and collaborate?
For example I could imagine to first just merge the basic test suite setup, so that the test command simply works and it's possible to add tests. Then we could merge whatever tests you already have (I guess Contributor), and then steadily add more to cover all code.
What do you think?
P.S.: The way kredits are earned with the labels, it should actually encourage the smallest possible pull requests, because the highest kredits amount is "large" (
kredits-3
), which shouldn't be more than a few days of work (equivalent to 10 small contributions, or a bit more than 3 medium ones). And in this case, I'm certain it should be more than a single large one.okay will close this one for now & do others small PRs
Cool!
Pull request closed