-
Notifications
You must be signed in to change notification settings - Fork 15
Conversation
Pull Request Test Coverage Report for Build 516
💛 - Coveralls |
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.
Huge improvement! Just a few changes needed.
.travis.yml
Outdated
@@ -12,7 +12,7 @@ addons: | |||
install: yarn install --pure-lockfile | |||
script: | |||
- yarn run lint | |||
- nohup yarn run ganache-cli & | |||
- nohup yarn run ganache-cli -a 15 & |
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.
yarn run ganache
since it is already a script.
package.json
Outdated
@@ -28,7 +28,8 @@ | |||
"commitmsg": "kleros-scripts commitmsg", | |||
"cz": "kleros-scripts cz", | |||
"start": "webpack --env.NODE_ENV=development --progress --watch", | |||
"build": "webpack --env.NODE_ENV=production -p" | |||
"build": "webpack --env.NODE_ENV=production -p", | |||
"ganache": "ganache-cli -a 15" |
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.
This can go right before test
to make the order clear.
title, | ||
description | ||
contractInstance.address, | ||
{ |
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
const userProfile = await this._StoreProvider.setUpUserProfile(account) | ||
// FIXME seems like a super hacky way to update store | ||
userProfile.balance = | ||
(parseInt(userProfile.balance, 10) ? userProfile.balance : 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.
good catch
src/abstractWrappers/Disputes.js
Outdated
dispute.arbitratorAddress, | ||
dispute.disputeId, | ||
(dispute.netPNK ? dispute.netPNK : 0) + amountShift | ||
{ | ||
netPNK: (dispute.netPNK ? dispute.netPNK : 0) + amountShift |
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.
(dispute.netPNK || 0) + amountShift
) | ||
|
||
if (_.isNull(notificationIndex)) { | ||
throw new TypeError(`No notification with txHash ${txHash} exists`) |
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.
Not really a TypeError
.
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 linter makes me do it
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 should look into making custom errors later. For cases like these and also the ones described here:
ethereum/EIPs#136
src/utils/StoreProviderWrapper.js
Outdated
userProfile.notifications[notificationIndex].read = isRead | ||
delete userProfile._id | ||
delete userProfile.created_at | ||
return new Promise(resolve => resolve(JSON.stringify(userProfile))) |
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.
unnecessary promise
} | ||
|
||
userProfile.notifications[notificationIndex].read = isRead | ||
delete userProfile._id |
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.
What is this for?
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.
_id and created_at are generated on the store. You can't push a profile with an id that already exists. And it is ordered by created_at so we need to remove the timestamp so we get a new one
util/PromiseQueue.js
Outdated
const returnPromise = new Promise(resolve => { | ||
returnResolver = resolve | ||
}) | ||
promise = promise.then(fn, fn).then(result => { |
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 work on this.
Just one thing. If fn
throws then returnPromise
will never resolve. Just add this to fix it:
promise = promise.then(fn, fn).then(res => returnResolver(res), err => returnRejecter(err))
let rngAddress | ||
let pnkAddress | ||
|
||
beforeAll(async () => { |
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.
You don't really need to use beforeAll
. You can just make the function passed to the parent describe
async
and do all of this inline.
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 its still useful to have it here so if we want to add more tests to this file we don't need to pull it back out
thanks for the review @epiqueras |
Hopefully the tests will be more reliable now and quicker. Next step is to mock the store interactions. Using the hosted store slows the tests down 3x.
NOTE: when running the tests locally you will need 15 accounts on your
testrpc
client