Skip to content

Commit

Permalink
Tests: Minor enhacements (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo authored Aug 10, 2020
1 parent 890c4b5 commit 68d906e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 68d906e

Please sign in to comment.