Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ernanirst committed Nov 12, 2023
1 parent 191e4ad commit 23d54b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const BASE_CONFIG = {
timeout: 840000,
},
gasReporter: {
enabled: false,
enabled: true,
excludeContracts: ['contracts/test'],
gasPrice: 100,
token: 'MATIC',
Expand Down
6 changes: 3 additions & 3 deletions test/SftRolesRegistry/SftRolesRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Contract } from 'ethers'
import { beforeEach } from 'mocha'
import { expect } from 'chai'
import { solidityKeccak256 } from 'ethers/lib/utils'
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers'
import { loadFixture, time } from '@nomicfoundation/hardhat-network-helpers'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
import { buildRoleAssignment, currentUnixTimestamp, ONE_DAY, generateRoleId, buildRevokeRoleData } from './helpers'
import { buildRoleAssignment, ONE_DAY, generateRoleId, buildRevokeRoleData } from './helpers'
import { RoleAssignment, RevokeRoleData } from './types'
import { generateRandomInt } from '../helpers'

Expand Down Expand Up @@ -42,7 +42,7 @@ describe('SftRolesRegistry', async () => {

it('should revert if expirationDate is in the past', async () => {
const roleAssignment = await buildRoleAssignment({
expirationDate: currentUnixTimestamp() - ONE_DAY,
expirationDate: (await time.latest()) - ONE_DAY,
})
await expect(SftRolesRegistry.grantRoleFrom(roleAssignment)).to.be.revertedWith(
'SftRolesRegistry: expiration date must be in the future',
Expand Down
4 changes: 0 additions & 4 deletions test/SftRolesRegistry/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,3 @@ export function buildRevokeRoleData(roleAssignment: RoleAssignment): RevokeRoleD
export function generateRoleId(role: string) {
return solidityKeccak256(['string'], [role])
}

export function currentUnixTimestamp() {
return Math.floor(Date.now() / 1000)
}

0 comments on commit 23d54b8

Please sign in to comment.