Contributor app tests #143
Labels
No Label
good first issue
ipfs
rsk
scaling
bug
dev environment
docs
duplicate
enhancement
feature
idea
invalid
kredits-1
kredits-2
kredits-3
question
release
major
release
minor
release
patch
security
ui/ux
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: kredits/contracts#143
Loading…
Reference in New Issue
No description provided.
Delete Branch "tests/contracts-contributor"
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?
This PR add unit tests for the Contributor app contracts. #103
can we merge this one ?
looks good to me. would be great if we can avoid the namehash dependency and use ethers.js for that.
that ganache-cli script is from aragon, isn't it?
@ -65,2 +65,4 @@
function updateContributorAccount(uint32 id, address oldAccount, address newAccount) public auth(MANAGE_CONTRIBUTORS_ROLE) {
require(newAccount != address(0), "invalid new account address");
require(getContributorAddressById(id) == oldAccount, "contributor does not exist");
👍 very good!
we should be able to use the namehash from ethers:
const namehash = require('ethers').utils.namehash;
as ethers.js is already a dependency we do not need to add another dependency
Are these test files linted? The formatting (e.g. indentation) seems to be all over the place from what I can see in the GitHub diff...
cool will change that
for the ganache script, it is basically the same aragon one, but I changed
to
Because
npx truffle test --network rpc "$@"
didn't work for me for no reason...ah ja, @haythem96 we used two spaces indentation on kredits. and you can run the linting using:
npm run lint:contract-tests
(though I had issues running the linter here right now. @skddc can you confirm this is correct?)Confirm that what exactly is correct?
@skddc that
npm run lint:contract-tests
is the right command to lint those files and that it works for you.on my machine it does not give me any output.
I tried it also, no output...
@haythem96 we don't have an explicit indentation rule, yet.
You can add
'indent': ['error', 2]
to the root.eslintrc.js
in the rules section.I didn't create those commands and I never tried linting contract test files (no tests until very recently), so I don't know.
Sounds like a good idea to me. Thanks, @fsmanuel.
Cool, fixed now.
@haythem96 thanks for adding the rule. Now you got us:
Can you please fix it! ❤️
done.
@haythem96 Did @bumi tell you about the kredits labels for issues and pull requests? This one is still missing the label...
(Documenting how this works should be solved during the current milestone, which is about onboarding.)
Yeah I know, I can't add a label...
@bumi Could you make sure that @haythem96 is fully set up, please? Thanks!
The package lockfile is missing in this branch again. :/
I just pulled this branch and ran
npm run test:contributor
, which I assume is what runs the code in here.Unfortunately, it just hangs with no output, after printing "Passing the command to Truffle":
@haythem96 I opened a PR to your repo/branch, so the tests are run on Travis: https://github.com/haythem96/kredits-contracts/pull/1
I've looked at the
ganache-cli.sh
script again and have a view questions/comments:aragon --devchain
instead of runningganache-cli
directly?rpc
environment - we should probably add atest
environment in the truffle.jsLooks like Travis can't deal with merging PRs in repo forks: https://travis-ci.org/67P/kredits-contracts/pull_requests
I guess pushing one more commit should do the trick.
If the other tests aren't supposed to work yet, then let's just change their npm scripts so that they don't run in
npm test
yet (e.g. changetest:token
to something likeecho 'WIP'
or similar).For some reasons if we change the env PORT variable and the port of the development network to
8545
it work...! cc @bumijust modified the npm test scripts to use the the ganache-cli script in the project instead of the one in @aragon/test-helpers so the other tests should work fine also...
So should we drop that ganache-cli script and use the devchain ?
@haythem96 no idea :) I was just wondering. As
aragon devchain
is also using ganache-cli I thought that might be closer to the dev environment.what do you think?
the tests should work now with running devchain manually before
npm run test
,didn't know how to config travis this way XD ...
I want more Kredits token :p can we fix the travis config ? the tests work now when running the
devchain
What exactly is unclear about doing the same on Travis as you do locally? Maybe I can answer your question.
These docs might help: https://docs.travis-ci.com/user/job-lifecycle/
I think Travis build works now
looks good, travis is happy... I got two more comments and I think we are good to merge :shipit:
what do you say? @skddc
do we still need those? and if so should we use the latest version?
same here: do we still need this and if so should we use the latest version?
I used the test-helpers package in the tests. For the solidity-coverage we may need it... or should I remove it ?
no, I was only wondering about the test-helpers. can we use the latest version here? 2.0.0
https://www.npmjs.com/package/@aragon/test-helpers or does that beak things?
I updated it now, did not break anything :)
ok, looks great, thanks a lot.
let's wait for @skddc's approval and then we merge it.
I trust your opinion. But please clean up the git history when merging. ;)
ok, cool. if we find issues or optimizations we do that in a new PR
I'd say we simply squasch merge this one.