New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added test file with initial tests. #6
Added test file with initial tests. #6
Conversation
…some issues with Redemptions contract. Created test file for Redemptions contract with initial passing test.
…abi/redemptions into redemptions-contract-changes # Conflicts: # contracts/Redemptions.sol
…o separate class.
…. Added more tests.
@fabriziovigevani and me will continue tomorrow with tests left. Thanks for set it up for us 🙏🏻 |
removeVaultTokenTest
Add redeem tests
Include new tests
Hey @willjgriff can you take a look to the progress we made over the weekend. Thanks |
.vscode/launch.json
Outdated
"args": ["test"] | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this .vscode file necessary? Can it be added to .gitignore?
contracts/Redemptions.sol
Outdated
|
||
require(redeemableToken.destroyTokens(msg.sender, _amount), ERROR_CANNOT_DESTROY_TOKENS); | ||
// minime.destroyTokens() never returns false, only reverts on failure | ||
redeemableToken.destroyTokens(msg.sender, _amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, we can remove the 'ERROR_CANNOT_DESTROY_TOKENS' error.
test/RedemptionsTest.js
Outdated
|
||
const redemptionAmount = 20000 | ||
const vaultToken0Ammount = 45231 | ||
const vaultToken1Ammount = 20001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, vaultToken1Amount
test/RedemptionsTest.js
Outdated
|
||
//mint redeemableTokens to first two accounts | ||
await redeemableToken.generateTokens(redeemer,redemptionAmount) | ||
await redeemableToken.generateTokens(rootAccount,80000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constant for the 80000?
|
||
it('reverts if amount to redeem exceeds account\'s balance', async () => { | ||
await assertRevert(redemptions.redeem(redemptionAmount + 1, { from:redeemer }),'REDEMPTIONS_INSUFFICIENT_BALANCE') | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could test the other require
statements but it's up to you.
Test and contract changes
Change reference to the token manager minor test fixes
As @fabriziovigevani mention on his PR:
|
Added test file with tests for
initialize()
andaddVaultToken()
, still needs tests forremoveVaultToken()
andredeem()
. It includes a helpers file and DaoDeployment file to extract some behaviour.Added babel to enable JS ES6 in test files.
Added truffle compiler config to compile to Solidity v0.4.24.
Fixed a couple bugs preventing compilation.
Added openzeppelin-solidity library for ERC20 contract. (Don't forget to
npm i
).I'm using truffle v5.0.14 not that it should matter but sometimes it does. You should be able to start
ganache-cli
then run tests in a separate terminal withtruffle test
.