[WIP] Solidity contracts tests #106
Closed
haythem96 wants to merge 17 commits from
tests/contracts into master
pull from: tests/contracts
merge into: :master
:master
:new-final-deploy
:new-final-deploy-2
:reimbursement-export
:staging
:legacy
:addresses/rsk-testnet-raucao-1
:ipfs-defaults
:deletemewhendone
:feature/184-improve_withdrawal
:tests/contracts-contribution
:tests/contracts-kit
:kit/add-vault-app
:feature/ipfs_hash_in_add_response
:chore/bootstrap-on-travis
:chore/remove-direct-aragon-cli-dependency
:chore/update-dependencies-1
:fix/ipfs-config
:apm-hack
:wtf/package-lock
:feature/contributor-balance
:feature/constructor-options
Labels
Clear labels
good first issue
ipfs
rsk
scaling
bug
dev environment
docs
duplicate
enhancement
feature
idea
invalid
kredits-1
kredits-2
kredits-3
question
security
ui/ux
wontfix
Good for newcomers
Something is not working
Config, builds, CI, deployment, etc.
Documentation
This issue or pull request already exists
Improving existing functionality
New functionality
Something to consider
Not a bug
Small contribution
Medium contribution
Large contribution
Looking for an answer
release
major
release
minor
release
patch
All your base are belong to us
User interface, process design, etc.
This won't be fixed
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: kredits/contracts#106
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Unit tests for Kredits smart contracts
@haythem96 pretty cool to see how to test the contracts. I'm wondering why the
pull upstream mastercommit 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: https://github.com/haythem96/kredits-contracts/commit/766463b57b87b2233a5bd681310da7332b9db904#diff-b24176ed2ec209da948c7ef4f480abe1L36but 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-undefconst 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-undefconst Proposal = artifacts.require("Proposal.sol");const { Contributor, getContributorContract } = require("../../contributor/artifacts");looks to me like
artifactsmight 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-undefconst 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 --fixandnpm run lint:contract-tests --fixto 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 definedor'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