-
Notifications
You must be signed in to change notification settings - Fork 366
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
[CENT-331]: Unify checkVariables and checkState #221
Conversation
…kMINTp0 function for unit tests
61541e3
to
fd3ded7
Compare
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 to see these tests working!
It would be nice if we could run all the tests with just checkVariables
, rather than a new method checkMINTp0
that requires different syntax for writing tests. This might be better suited for a separate PR, but here's what I'm thinking:
When we create the MintController token object, add a property to the truffle contract object, mintController.tokenType = "MintController"
. Then in checkVariables
, the buildExpectedState
and getActualState
functions check the tokenType
property before determining what state the token should have. If tokenType == MintController, delegate to getActualStateOfMintController
and buildMintControllerExpectedState
.
I left some other minor questions/comments, we don't necessarily have to address the checkVariables
thing in this PR, but figured I'd bring it up.
test/minting/ControllerTestUtils.js
Outdated
@@ -1,5 +1,6 @@ | |||
var BigNumber = require('bignumber.js'); | |||
var Q = require('q'); | |||
var clone = require('clone'); |
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.
Looks unused in this file
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.
Deleting.
} | ||
|
||
|
||
// Gets the actual state of the mintController contract. | ||
// Evaluates all mappings on the provided accounts. | ||
async function getActualMintControllerState(mintController, accounts) { | ||
return { | ||
'minterManager': await mintController.minterManager.call() | ||
var minterManager = await mintController.minterManager.call(); |
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.
Should this check that the value of each account in accounts
in the controllers mapping? Looks like that was the original plan based on the accounts
param and the comment. Also, maybe owner should be added, since that is also part of the state?
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.
The function checkMintControllerState
calls checkControllerState
in ControllerTestUtils.js. This lets us take advantage of inheritance:
MintController is Controller. So the
controllersmapping and
owner` variable states are checked there.
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.
In that case can we remove the accounts
param here?
@@ -23,9 +23,9 @@ | |||
version "0.7.0" |
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.
looks like we need to run "yarn install" again from build error
We discussed creating a special function |
-Created checkMINTp0 that is specific for testing MINT p0 contracts.
-Created ControllerState and MintControllerState objects
-Replaced cloneState with 3rd party clone() function.