Skip to content
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

Tests: Minor enhancements #611

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/contracts/common/safe_erc20.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ contract('SafeERC20', ([owner, receiver]) => {
await safeERC20Mock.approve(tokenMock.address, receiver, preApprovedAmount)

// Attempt to create another approval without reseting it back to 0
const receipt = await safeERC20Mock.approve(tokenMock.address, receiver, preApprovedAmount - 500)
const receipt = await safeERC20Mock.approve(tokenMock.address, receiver, preApprovedAmount.sub(bn(500)))

assertMockResult(receipt, false)
assertBn(await tokenMock.allowance(safeERC20Mock.address, receiver), preApprovedAmount, 'Allowance of receiver should be the pre-existing value')
Expand All @@ -91,7 +91,7 @@ contract('SafeERC20', ([owner, receiver]) => {
// Transfer to receiver through the mock
const receipt = await safeERC20Mock.transferFrom(tokenMock.address, owner, receiver, approvedAmount)
assertMockResult(receipt, true)
assertBn(await tokenMock.balanceOf(owner), initialBalance - approvedAmount, 'Balance of owner should be correct')
assertBn(await tokenMock.balanceOf(owner), initialBalance.sub(approvedAmount), 'Balance of owner should be correct')
assertBn(await tokenMock.balanceOf(receiver), approvedAmount, 'Balance of receiver should be correct')
assertBn(await tokenMock.balanceOf(safeERC20Mock.address), 0, 'Balance of mock should stay the same')
})
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/common/time_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract('TimeHelpers', () => {

it('checks block number', async () => {
assert.equal((await timeHelpersMock.getBlockNumberExt()).toString(), (await timeHelpersMock.getBlockNumber64Ext()).toString(), "block numbers should match")
assert.equal((await timeHelpersMock.getBlockNumberExt()).toString(), (await timeHelpersMock.getBlockNumberDirect()).toString(), web3.eth.getBlockNumber, "block number should match with real one", "block number should match with real one")
assert.equal((await timeHelpersMock.getBlockNumberExt()).toString(), (await timeHelpersMock.getBlockNumberDirect()).toString(), "block number should match with real one")
})

it('checks time stamp', async () => {
Expand Down