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
Fixed a broken payment test (+ another small fix) #1318
Conversation
As a sidenote, I believe the public getter The standard way to implement this would have been to declare a public variable address[] public payees; and then let the But I can see that the implementation is as follows: address[] private _payees;
function payee(uint256 index) public view returns(address) {
return _payees[index];
} I gather that this was done so that contract variables could be _prefixed, but the public getter would be “clean”. However I think that at least the public getter should be named as it would have been named if there weren’t this “workaround.” |
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.
Awesome @dwardu, thanks! It's a bit worrying that this didn't cause an error in the suite, I'll review the other tests.
@@ -14,4 +14,4 @@ Fixes # | |||
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](../blob/master/CONTRIBUTING.md) | |||
- [ ] ✅ I've added tests where applicable to test my new functionality. | |||
- [ ] 📖 I've made sure that my contracts are well-documented. | |||
- [ ] 🎨 I've run the JS/Solidity linters and fixed any issues (`npm run lint:all:fix`). |
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.
Good catch!
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.
I caught the mistake in the PR template… because I was obeying the PR template 😀
Regarding the naming of the getter, I think it was @ElOpio who made that call, and I agree with it. |
Yes, despite |
Yes, I was also wondering how the failed test had managed to go through! |
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.
I think the fact that we didn't get an error was related to the promises not being awaited, Mocha sometimes does weird stuff in those cases.
Anyway, thanks a lot!
Btw, regarding your naming suggestion, feel free to open an issue for us to discuss this, if you think it may be a source of confusion :) |
* Fixed a broken payment test * In PR template, npm run lint:fix, not lint:all:fix * In SplitPayment test, replaced an await-in-loop with Promise.all (cherry picked from commit b79196f)
Test was referencing a local variable instead of calling the contract method.