-
Notifications
You must be signed in to change notification settings - Fork 374
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-361] Modify TokenTestUtils function buildExpectedState/getActualState #228
[CENT-361] Modify TokenTestUtils function buildExpectedState/getActualState #228
Conversation
Unit test run was taking about 1 hour. I removed some accounts from Accounts. I also created a subset of Accounts (allowanceMappingAccounts) for evaluating the allowances map. This decreased the typical unit test time from 6500ms to 2700ms. |
9dc639a
to
5e88595
Compare
I have some concerns with this approach:
What do you think @o-a-hudson? |
I agree with @walkerq 's suggestions here. I think that will make the testing less error-prone which seems worth it given that this is smart contract code. I think we could consider other approaches for speeding up the tests, such as parallelizing the tests across different blockchain network instances each with a subset of the tests. |
test/AccountUtils.js
Outdated
@@ -112,11 +111,20 @@ async function checkState(_tokens, _customVars, emptyState, getActualState, acco | |||
// returns an object containing the results of calling mappingQuery on each account |
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: mappingQuery -> accountQuery
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.
fixed
test/MiscTests.js
Outdated
await expectRevert(token.mint(Accounts.pauserAccount, mintAmount, { from: Accounts.arbitraryAccount })); | ||
//await expectRevert(token.mint(Accounts.pauserAccount, 0, { from: Accounts.arbitraryAccount })); | ||
await expectRevert(token.mint(Accounts.arbitraryAccount2, mintAmount, { from: Accounts.arbitraryAccount })); | ||
//await expectRevert(token.mint(Accounts.arbitraryAccount2, 0, { from: Accounts.arbitraryAccount })); |
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.
comment can be deleted
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.
fixed
test/minting/error.txt
Outdated
@@ -0,0 +1,140 @@ | |||
1) Contract: FiatToken_MiscTests |
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.
We don't want to commit this file, do we?
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.
ooops - this is a personal scratch file.
test/TokenTestUtils.js
Outdated
}; | ||
|
||
|
||
function recursiveSetAccountDefault(accounts, value) { |
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.
We might want to move this to AccountUtils
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.
fixed.
Updated TokenTestUtils to use the Accounts interface for managing token state
Removed some redundant code from other files.