diff --git a/test/access/AccessControl.behavior.js b/test/access/AccessControl.behavior.js index 7a0e292bd..1b4e27a61 100644 --- a/test/access/AccessControl.behavior.js +++ b/test/access/AccessControl.behavior.js @@ -18,7 +18,7 @@ function shouldBehaveLikeAccessControl() { describe('default admin', function () { it('deployer has default admin role', async function () { - expect(await this.mock.hasRole(DEFAULT_ADMIN_ROLE, this.defaultAdmin)).to.equal(true); + expect(await this.mock.hasRole(DEFAULT_ADMIN_ROLE, this.defaultAdmin)).to.be.true; }); it("other roles's admin is the default admin role", async function () { @@ -52,7 +52,7 @@ function shouldBehaveLikeAccessControl() { describe('revoking', function () { it('roles that are not had can be revoked', async function () { - expect(await this.mock.hasRole(ROLE, this.authorized)).to.equal(false); + expect(await this.mock.hasRole(ROLE, this.authorized)).to.be.false; await expect(this.mock.connect(this.defaultAdmin).revokeRole(ROLE, this.authorized)).to.not.emit( this.mock, @@ -60,7 +60,7 @@ function shouldBehaveLikeAccessControl() { ); }); - context('with granted role', function () { + describe('with granted role', function () { beforeEach(async function () { await this.mock.connect(this.defaultAdmin).grantRole(ROLE, this.authorized); }); @@ -70,7 +70,7 @@ function shouldBehaveLikeAccessControl() { .to.emit(this.mock, 'RoleRevoked') .withArgs(ROLE, this.authorized, this.defaultAdmin); - expect(await this.mock.hasRole(ROLE, this.authorized)).to.equal(false); + expect(await this.mock.hasRole(ROLE, this.authorized)).to.be.false; }); it('non-admin cannot revoke role', async function () { @@ -98,7 +98,7 @@ function shouldBehaveLikeAccessControl() { ); }); - context('with granted role', function () { + describe('with granted role', function () { beforeEach(async function () { await this.mock.connect(this.defaultAdmin).grantRole(ROLE, this.authorized); }); @@ -108,7 +108,7 @@ function shouldBehaveLikeAccessControl() { .to.emit(this.mock, 'RoleRevoked') .withArgs(ROLE, this.authorized, this.authorized); - expect(await this.mock.hasRole(ROLE, this.authorized)).to.equal(false); + expect(await this.mock.hasRole(ROLE, this.authorized)).to.be.false; }); it('only the sender can renounce their roles', async function () { @@ -666,7 +666,7 @@ function shouldBehaveLikeAccessControlDefaultAdminRules() { await this.mock.connect(this.other).renounceRole(DEFAULT_ADMIN_ROLE, this.other); expect(await this.mock.hasRole(DEFAULT_ADMIN_ROLE, this.defaultAdmin)).to.be.true; - expect(await this.mock.defaultAdmin()).to.be.equal(this.defaultAdmin); + expect(await this.mock.defaultAdmin()).to.equal(this.defaultAdmin); }); it('renounces role', async function () { @@ -676,7 +676,7 @@ function shouldBehaveLikeAccessControlDefaultAdminRules() { .withArgs(DEFAULT_ADMIN_ROLE, this.defaultAdmin, this.defaultAdmin); expect(await this.mock.hasRole(DEFAULT_ADMIN_ROLE, this.defaultAdmin)).to.be.false; - expect(await this.mock.defaultAdmin()).to.be.equal(ethers.ZeroAddress); + expect(await this.mock.defaultAdmin()).to.equal(ethers.ZeroAddress); expect(await this.mock.owner()).to.equal(ethers.ZeroAddress); const { newAdmin, schedule } = await this.mock.pendingDefaultAdmin(); diff --git a/test/access/manager/AccessManager.test.js b/test/access/manager/AccessManager.test.js index 959fd7cda..108795dff 100644 --- a/test/access/manager/AccessManager.test.js +++ b/test/access/manager/AccessManager.test.js @@ -1072,13 +1072,13 @@ describe('AccessManager', function () { }); it('changes the authority', async function () { - expect(await this.newManagedTarget.authority()).to.be.equal(this.manager); + expect(await this.newManagedTarget.authority()).to.equal(this.manager); await expect(this.manager.connect(this.admin).updateAuthority(this.newManagedTarget, this.newAuthority)) .to.emit(this.newManagedTarget, 'AuthorityUpdated') // Managed contract is responsible of notifying the change through an event .withArgs(this.newAuthority); - expect(await this.newManagedTarget.authority()).to.be.equal(this.newAuthority); + expect(await this.newManagedTarget.authority()).to.equal(this.newAuthority); }); }); @@ -1250,7 +1250,7 @@ describe('AccessManager', function () { // Already in effect const currentTimestamp = await time.clock.timestamp(); - expect(currentTimestamp).to.be.equal(access[0]); + expect(currentTimestamp).to.equal(access[0]); expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([ true, this.executionDelay.toString(), @@ -1291,7 +1291,7 @@ describe('AccessManager', function () { // Already in effect const currentTimestamp = await time.clock.timestamp(); - expect(currentTimestamp).to.be.equal(access[0]); + expect(currentTimestamp).to.equal(access[0]); expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([ true, executionDelay.toString(), @@ -2342,7 +2342,7 @@ describe('AccessManager', function () { }); it('initial state', async function () { - expect(await this.ownable.owner()).to.be.equal(this.manager); + expect(await this.ownable.owner()).to.equal(this.manager); }); describe('Contract is closed', function () { diff --git a/test/access/manager/AuthorityUtils.test.js b/test/access/manager/AuthorityUtils.test.js index 44fa10712..905913f14 100644 --- a/test/access/manager/AuthorityUtils.test.js +++ b/test/access/manager/AuthorityUtils.test.js @@ -40,8 +40,8 @@ describe('AuthorityUtils', function () { this.other, '0x12345678', ); - expect(immediate).to.equal(false); - expect(delay).to.be.equal(0n); + expect(immediate).to.be.false; + expect(delay).to.equal(0n); }); }); @@ -60,7 +60,7 @@ describe('AuthorityUtils', function () { '0x12345678', ); expect(immediate).to.equal(this.immediate); - expect(delay).to.be.equal(0n); + expect(delay).to.equal(0n); }); }); @@ -76,7 +76,7 @@ describe('AuthorityUtils', function () { await this.authority._setDelay(delay); const result = await this.mock.$canCallWithDelay(this.authority, this.user, this.other, '0x12345678'); expect(result.immediate).to.equal(immediate); - expect(result.delay).to.be.equal(delay); + expect(result.delay).to.equal(delay); }); } } @@ -94,8 +94,8 @@ describe('AuthorityUtils', function () { this.other, '0x12345678', ); - expect(immediate).to.equal(false); - expect(delay).to.be.equal(0n); + expect(immediate).to.be.false; + expect(delay).to.equal(0n); }); }); }); diff --git a/test/finance/VestingWallet.behavior.js b/test/finance/VestingWallet.behavior.js index a934dc4b0..4b4804ac5 100644 --- a/test/finance/VestingWallet.behavior.js +++ b/test/finance/VestingWallet.behavior.js @@ -7,8 +7,8 @@ function shouldBehaveLikeVesting() { await time.increaseTo.timestamp(timestamp); const vesting = this.vestingFn(timestamp); - expect(await this.mock.vestedAmount(...this.args, timestamp)).to.be.equal(vesting); - expect(await this.mock.releasable(...this.args)).to.be.equal(vesting); + expect(await this.mock.vestedAmount(...this.args, timestamp)).to.equal(vesting); + expect(await this.mock.releasable(...this.args)).to.equal(vesting); } }); diff --git a/test/finance/VestingWallet.test.js b/test/finance/VestingWallet.test.js index eee9041dc..8ea87b035 100644 --- a/test/finance/VestingWallet.test.js +++ b/test/finance/VestingWallet.test.js @@ -76,10 +76,10 @@ describe('VestingWallet', function () { }); it('check vesting contract', async function () { - expect(await this.mock.owner()).to.be.equal(this.beneficiary); - expect(await this.mock.start()).to.be.equal(this.start); - expect(await this.mock.duration()).to.be.equal(this.duration); - expect(await this.mock.end()).to.be.equal(this.start + this.duration); + expect(await this.mock.owner()).to.equal(this.beneficiary); + expect(await this.mock.start()).to.equal(this.start); + expect(await this.mock.duration()).to.equal(this.duration); + expect(await this.mock.end()).to.equal(this.start + this.duration); }); describe('vesting schedule', function () { diff --git a/test/metatx/ERC2771Context.test.js b/test/metatx/ERC2771Context.test.js index 2b69a486c..15da61dad 100644 --- a/test/metatx/ERC2771Context.test.js +++ b/test/metatx/ERC2771Context.test.js @@ -26,7 +26,7 @@ describe('ERC2771Context', function () { }); it('recognize trusted forwarder', async function () { - expect(await this.context.isTrustedForwarder(this.forwarder)).to.equal(true); + expect(await this.context.isTrustedForwarder(this.forwarder)).to.be.true; }); it('returns the trusted forwarder', async function () { @@ -55,7 +55,7 @@ describe('ERC2771Context', function () { req.signature = await this.sender.signTypedData(this.domain, this.types, req); - expect(await this.forwarder.verify(req)).to.equal(true); + expect(await this.forwarder.verify(req)).to.be.true; await expect(this.forwarder.execute(req)).to.emit(this.context, 'Sender').withArgs(this.sender); }); @@ -87,7 +87,7 @@ describe('ERC2771Context', function () { req.signature = this.sender.signTypedData(this.domain, this.types, req); - expect(await this.forwarder.verify(req)).to.equal(true); + expect(await this.forwarder.verify(req)).to.be.true; await expect(this.forwarder.execute(req)) .to.emit(this.context, 'Data') @@ -126,7 +126,7 @@ describe('ERC2771Context', function () { req.signature = await this.sender.signTypedData(this.domain, this.types, req); - expect(await this.forwarder.verify(req)).to.equal(true); + expect(await this.forwarder.verify(req)).to.be.true; await expect(this.forwarder.execute(req)).to.emit(this.context, 'Sender').withArgs(this.sender); }); diff --git a/test/metatx/ERC2771Forwarder.test.js b/test/metatx/ERC2771Forwarder.test.js index 5bd0bf404..8a2a09233 100644 --- a/test/metatx/ERC2771Forwarder.test.js +++ b/test/metatx/ERC2771Forwarder.test.js @@ -74,9 +74,9 @@ describe('ERC2771Forwarder', function () { describe('with valid signature', function () { it('returns true without altering the nonce', async function () { const request = await this.forgeRequest(); - expect(await this.forwarder.nonces(request.from)).to.be.equal(request.nonce); - expect(await this.forwarder.verify(request)).to.be.equal(true); - expect(await this.forwarder.nonces(request.from)).to.be.equal(request.nonce); + expect(await this.forwarder.nonces(request.from)).to.equal(request.nonce); + expect(await this.forwarder.verify(request)).to.be.true; + expect(await this.forwarder.nonces(request.from)).to.equal(request.nonce); }); }); @@ -86,18 +86,18 @@ describe('ERC2771Forwarder', function () { const request = await this.forgeRequest(); request[key] = typeof value == 'function' ? value(request[key]) : value; - expect(await this.forwarder.verify(request)).to.be.equal(false); + expect(await this.forwarder.verify(request)).to.be.false; }); } it('returns false with valid signature for non-current nonce', async function () { const request = await this.forgeRequest({ nonce: 1337n }); - expect(await this.forwarder.verify(request)).to.be.equal(false); + expect(await this.forwarder.verify(request)).to.be.false; }); it('returns false with valid signature for expired deadline', async function () { const request = await this.forgeRequest({ deadline: (await time.clock.timestamp()) - 1n }); - expect(await this.forwarder.verify(request)).to.be.equal(false); + expect(await this.forwarder.verify(request)).to.be.false; }); }); }); @@ -114,7 +114,7 @@ describe('ERC2771Forwarder', function () { .to.emit(this.forwarder, 'ExecutedForwardRequest') .withArgs(request.from, request.nonce, true); - expect(await this.forwarder.nonces(request.from)).to.be.equal(request.nonce + 1n); + expect(await this.forwarder.nonces(request.from)).to.equal(request.nonce + 1n); }); it('reverts with an unsuccessful request', async function () { @@ -196,7 +196,7 @@ describe('ERC2771Forwarder', function () { .then(block => block.getTransaction(0)) .then(tx => ethers.provider.getTransactionReceipt(tx.hash)); - expect(gasUsed).to.be.equal(gasLimit); + expect(gasUsed).to.equal(gasLimit); }); it('bubbles out of gas forced by the relayer', async function () { @@ -226,7 +226,7 @@ describe('ERC2771Forwarder', function () { .then(tx => ethers.provider.getTransactionReceipt(tx.hash)); // We assert that indeed the gas was totally consumed. - expect(gasUsed).to.be.equal(gasLimit); + expect(gasUsed).to.equal(gasLimit); }); }); @@ -245,7 +245,7 @@ describe('ERC2771Forwarder', function () { describe('with valid requests', function () { it('sanity', async function () { for (const request of this.requests) { - expect(await this.forwarder.verify(request)).to.be.equal(true); + expect(await this.forwarder.verify(request)).to.be.true; } }); @@ -264,7 +264,7 @@ describe('ERC2771Forwarder', function () { await this.forwarder.executeBatch(this.requests, this.another, { value: this.value }); for (const request of this.requests) { - expect(await this.forwarder.nonces(request.from)).to.be.equal(request.nonce + 1n); + expect(await this.forwarder.nonces(request.from)).to.equal(request.nonce + 1n); } }); }); @@ -395,12 +395,12 @@ describe('ERC2771Forwarder', function () { afterEach(async function () { // The invalid request value was refunded - expect(await ethers.provider.getBalance(this.refundReceiver)).to.be.equal( + expect(await ethers.provider.getBalance(this.refundReceiver)).to.equal( this.initialRefundReceiverBalance + this.requests[idx].value, ); // The invalid request from's nonce was not incremented - expect(await this.forwarder.nonces(this.requests[idx].from)).to.be.equal(this.initialTamperedRequestNonce); + expect(await this.forwarder.nonces(this.requests[idx].from)).to.equal(this.initialTamperedRequestNonce); }); }); @@ -423,7 +423,7 @@ describe('ERC2771Forwarder', function () { .then(block => block.getTransaction(0)) .then(tx => ethers.provider.getTransactionReceipt(tx.hash)); - expect(gasUsed).to.be.equal(gasLimit); + expect(gasUsed).to.equal(gasLimit); }); it('bubbles out of gas forced by the relayer', async function () { @@ -454,7 +454,7 @@ describe('ERC2771Forwarder', function () { .then(tx => ethers.provider.getTransactionReceipt(tx.hash)); // We assert that indeed the gas was totally consumed. - expect(gasUsed).to.be.equal(gasLimit); + expect(gasUsed).to.equal(gasLimit); }); }); }); diff --git a/test/proxy/transparent/ProxyAdmin.test.js b/test/proxy/transparent/ProxyAdmin.test.js index d70075d04..df430d46a 100644 --- a/test/proxy/transparent/ProxyAdmin.test.js +++ b/test/proxy/transparent/ProxyAdmin.test.js @@ -36,7 +36,7 @@ describe('ProxyAdmin', function () { }); describe('without data', function () { - context('with unauthorized account', function () { + describe('with unauthorized account', function () { it('fails to upgrade', async function () { await expect(this.proxyAdmin.connect(this.other).upgradeAndCall(this.proxy, this.v2, '0x')) .to.be.revertedWithCustomError(this.proxyAdmin, 'OwnableUnauthorizedAccount') @@ -44,16 +44,16 @@ describe('ProxyAdmin', function () { }); }); - context('with authorized account', function () { + describe('with authorized account', function () { it('upgrades implementation', async function () { await this.proxyAdmin.connect(this.admin).upgradeAndCall(this.proxy, this.v2, '0x'); - expect(await getAddressInSlot(this.proxy, ImplementationSlot)).to.be.equal(this.v2); + expect(await getAddressInSlot(this.proxy, ImplementationSlot)).to.equal(this.v2); }); }); }); describe('with data', function () { - context('with unauthorized account', function () { + describe('with unauthorized account', function () { it('fails to upgrade', async function () { const data = this.v1.interface.encodeFunctionData('initializeNonPayableWithValue', [1337n]); await expect(this.proxyAdmin.connect(this.other).upgradeAndCall(this.proxy, this.v2, data)) @@ -62,19 +62,19 @@ describe('ProxyAdmin', function () { }); }); - context('with authorized account', function () { - context('with invalid callData', function () { + describe('with authorized account', function () { + describe('with invalid callData', function () { it('fails to upgrade', async function () { const data = '0x12345678'; await expect(this.proxyAdmin.connect(this.admin).upgradeAndCall(this.proxy, this.v2, data)).to.be.reverted; }); }); - context('with valid callData', function () { + describe('with valid callData', function () { it('upgrades implementation', async function () { const data = this.v2.interface.encodeFunctionData('initializeNonPayableWithValue', [1337n]); await this.proxyAdmin.connect(this.admin).upgradeAndCall(this.proxy, this.v2, data); - expect(await getAddressInSlot(this.proxy, ImplementationSlot)).to.be.equal(this.v2); + expect(await getAddressInSlot(this.proxy, ImplementationSlot)).to.equal(this.v2); }); }); }); diff --git a/test/sanity.test.js b/test/sanity.test.js index 1fe2fa9c9..1733c9654 100644 --- a/test/sanity.test.js +++ b/test/sanity.test.js @@ -26,11 +26,11 @@ describe('Environment sanity', function () { it('cache and mine', async function () { blockNumberBefore = await ethers.provider.getBlockNumber(); await mine(); - expect(await ethers.provider.getBlockNumber()).to.be.equal(blockNumberBefore + 1); + expect(await ethers.provider.getBlockNumber()).to.equal(blockNumberBefore + 1); }); it('check snapshot', async function () { - expect(await ethers.provider.getBlockNumber()).to.be.equal(blockNumberBefore); + expect(await ethers.provider.getBlockNumber()).to.equal(blockNumberBefore); }); }); }); diff --git a/test/token/ERC1155/extensions/ERC1155Pausable.test.js b/test/token/ERC1155/extensions/ERC1155Pausable.test.js index 21a2e0bca..81c4f69bc 100644 --- a/test/token/ERC1155/extensions/ERC1155Pausable.test.js +++ b/test/token/ERC1155/extensions/ERC1155Pausable.test.js @@ -18,7 +18,7 @@ describe('ERC1155Pausable', function () { Object.assign(this, await loadFixture(fixture)); }); - context('when token is paused', function () { + describe('when token is paused', function () { beforeEach(async function () { await this.token.connect(this.holder).setApprovalForAll(this.operator, true); await this.token.$_mint(this.holder, firstTokenId, firstTokenValue, '0x'); diff --git a/test/token/ERC20/extensions/ERC20Wrapper.test.js b/test/token/ERC20/extensions/ERC20Wrapper.test.js index 697bfe523..14d8d9a64 100644 --- a/test/token/ERC20/extensions/ERC20Wrapper.test.js +++ b/test/token/ERC20/extensions/ERC20Wrapper.test.js @@ -26,7 +26,7 @@ describe('ERC20Wrapper', function () { }); afterEach('Underlying balance', async function () { - expect(await this.underlying.balanceOf(this.token)).to.be.equal(await this.token.totalSupply()); + expect(await this.underlying.balanceOf(this.token)).to.equal(await this.token.totalSupply()); }); it('has a name', async function () { @@ -38,17 +38,17 @@ describe('ERC20Wrapper', function () { }); it('has the same decimals as the underlying token', async function () { - expect(await this.token.decimals()).to.be.equal(decimals); + expect(await this.token.decimals()).to.equal(decimals); }); it('decimals default back to 18 if token has no metadata', async function () { const noDecimals = await ethers.deployContract('CallReceiverMock'); const token = await ethers.deployContract('$ERC20Wrapper', [`Wrapped ${name}`, `W${symbol}`, noDecimals]); - expect(await token.decimals()).to.be.equal(18n); + expect(await token.decimals()).to.equal(18n); }); it('has underlying', async function () { - expect(await this.token.underlying()).to.be.equal(this.underlying); + expect(await this.token.underlying()).to.equal(this.underlying); }); describe('deposit', function () { diff --git a/test/token/ERC20/utils/SafeERC20.test.js b/test/token/ERC20/utils/SafeERC20.test.js index 80d394edd..703fcd57b 100644 --- a/test/token/ERC20/utils/SafeERC20.test.js +++ b/test/token/ERC20/utils/SafeERC20.test.js @@ -168,7 +168,7 @@ function shouldOnlyRevertOnErrors() { }); describe('approvals', function () { - context('with zero allowance', function () { + describe('with zero allowance', function () { beforeEach(async function () { await this.token.$_approve(this.mock, this.spender, 0n); }); @@ -195,7 +195,7 @@ function shouldOnlyRevertOnErrors() { }); }); - context('with non-zero allowance', function () { + describe('with non-zero allowance', function () { beforeEach(async function () { await this.token.$_approve(this.mock, this.spender, 100n); }); diff --git a/test/token/ERC721/extensions/ERC721Burnable.test.js b/test/token/ERC721/extensions/ERC721Burnable.test.js index 95504d3f5..d6f0b80c4 100644 --- a/test/token/ERC721/extensions/ERC721Burnable.test.js +++ b/test/token/ERC721/extensions/ERC721Burnable.test.js @@ -48,7 +48,7 @@ describe('ERC721Burnable', function () { await this.token.connect(this.owner).burn(tokenId); }); - context('getApproved', function () { + describe('getApproved', function () { it('reverts', async function () { await expect(this.token.getApproved(tokenId)) .to.be.revertedWithCustomError(this.token, 'ERC721NonexistentToken') diff --git a/test/token/ERC721/extensions/ERC721Pausable.test.js b/test/token/ERC721/extensions/ERC721Pausable.test.js index 56585e744..acf731a45 100644 --- a/test/token/ERC721/extensions/ERC721Pausable.test.js +++ b/test/token/ERC721/extensions/ERC721Pausable.test.js @@ -19,7 +19,7 @@ describe('ERC721Pausable', function () { Object.assign(this, await loadFixture(fixture)); }); - context('when token is paused', function () { + describe('when token is paused', function () { beforeEach(async function () { await this.token.$_mint(this.owner, tokenId); await this.token.$_pause(); diff --git a/test/utils/Arrays.test.js b/test/utils/Arrays.test.js index 375b9422f..c585fee58 100644 --- a/test/utils/Arrays.test.js +++ b/test/utils/Arrays.test.js @@ -85,7 +85,7 @@ describe('Arrays', function () { it(name, async function () { // findUpperBound does not support duplicated if (hasDuplicates(array)) this.skip(); - expect(await this.mock.findUpperBound(input)).to.be.equal(lowerBound(array, input)); + expect(await this.mock.findUpperBound(input)).to.equal(lowerBound(array, input)); }); } }); @@ -114,7 +114,7 @@ describe('Arrays', function () { for (const [name, { elements }] of Object.entries(contractCases)) { it(name, async function () { for (const i in elements) { - expect(await this.contracts[name].unsafeAccess(i)).to.be.equal(elements[i]); + expect(await this.contracts[name].unsafeAccess(i)).to.equal(elements[i]); } }); } diff --git a/test/utils/cryptography/MerkleProof.test.js b/test/utils/cryptography/MerkleProof.test.js index 73e1ada95..9b0b34d3f 100644 --- a/test/utils/cryptography/MerkleProof.test.js +++ b/test/utils/cryptography/MerkleProof.test.js @@ -27,16 +27,16 @@ describe('MerkleProof', function () { const hash = merkleTree.leafHash(['A']); const proof = merkleTree.getProof(['A']); - expect(await this.mock.$verify(proof, root, hash)).to.equal(true); - expect(await this.mock.$verifyCalldata(proof, root, hash)).to.equal(true); + expect(await this.mock.$verify(proof, root, hash)).to.be.true; + expect(await this.mock.$verifyCalldata(proof, root, hash)).to.be.true; // For demonstration, it is also possible to create valid proofs for certain 64-byte values *not* in elements: const noSuchLeaf = hashPair( ethers.toBeArray(merkleTree.leafHash(['A'])), ethers.toBeArray(merkleTree.leafHash(['B'])), ); - expect(await this.mock.$verify(proof.slice(1), root, noSuchLeaf)).to.equal(true); - expect(await this.mock.$verifyCalldata(proof.slice(1), root, noSuchLeaf)).to.equal(true); + expect(await this.mock.$verify(proof.slice(1), root, noSuchLeaf)).to.be.true; + expect(await this.mock.$verifyCalldata(proof.slice(1), root, noSuchLeaf)).to.be.true; }); it('returns false for an invalid Merkle proof', async function () { @@ -47,8 +47,8 @@ describe('MerkleProof', function () { const hash = correctMerkleTree.leafHash(['a']); const proof = otherMerkleTree.getProof(['d']); - expect(await this.mock.$verify(proof, root, hash)).to.equal(false); - expect(await this.mock.$verifyCalldata(proof, root, hash)).to.equal(false); + expect(await this.mock.$verify(proof, root, hash)).to.be.false; + expect(await this.mock.$verifyCalldata(proof, root, hash)).to.be.false; }); it('returns false for a Merkle proof of invalid length', async function () { @@ -59,8 +59,8 @@ describe('MerkleProof', function () { const proof = merkleTree.getProof(['a']); const badProof = proof.slice(0, proof.length - 5); - expect(await this.mock.$verify(badProof, root, leaf)).to.equal(false); - expect(await this.mock.$verifyCalldata(badProof, root, leaf)).to.equal(false); + expect(await this.mock.$verify(badProof, root, leaf)).to.be.false; + expect(await this.mock.$verifyCalldata(badProof, root, leaf)).to.be.false; }); }); @@ -72,8 +72,8 @@ describe('MerkleProof', function () { const { proof, proofFlags, leaves } = merkleTree.getMultiProof(toElements('bdf')); const hashes = leaves.map(e => merkleTree.leafHash(e)); - expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.equal(true); - expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.equal(true); + expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.be.true; + expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.be.true; }); it('returns false for an invalid Merkle multi proof', async function () { @@ -84,8 +84,8 @@ describe('MerkleProof', function () { const { proof, proofFlags, leaves } = otherMerkleTree.getMultiProof(toElements('ghi')); const hashes = leaves.map(e => merkleTree.leafHash(e)); - expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.equal(false); - expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.equal(false); + expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.be.false; + expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.be.false; }); it('revert with invalid multi proof #1', async function () { @@ -139,16 +139,16 @@ describe('MerkleProof', function () { const { proof, proofFlags, leaves } = merkleTree.getMultiProof(toElements('a')); const hashes = leaves.map(e => merkleTree.leafHash(e)); - expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.equal(true); - expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.equal(true); + expect(await this.mock.$multiProofVerify(proof, proofFlags, root, hashes)).to.be.true; + expect(await this.mock.$multiProofVerifyCalldata(proof, proofFlags, root, hashes)).to.be.true; }); it('limit case: can prove empty leaves', async function () { const merkleTree = StandardMerkleTree.of(toElements('abcd'), ['string']); const root = merkleTree.root; - expect(await this.mock.$multiProofVerify([root], [], root, [])).to.equal(true); - expect(await this.mock.$multiProofVerifyCalldata([root], [], root, [])).to.equal(true); + expect(await this.mock.$multiProofVerify([root], [], root, [])).to.be.true; + expect(await this.mock.$multiProofVerifyCalldata([root], [], root, [])).to.be.true; }); it('reverts processing manipulated proofs with a zero-value node at depth 1', async function () { diff --git a/test/utils/structs/BitMap.test.js b/test/utils/structs/BitMap.test.js index a7685414e..5662ab13f 100644 --- a/test/utils/structs/BitMap.test.js +++ b/test/utils/structs/BitMap.test.js @@ -17,25 +17,25 @@ describe('BitMap', function () { }); it('starts empty', async function () { - expect(await this.bitmap.$get(0, keyA)).to.equal(false); - expect(await this.bitmap.$get(0, keyB)).to.equal(false); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.false; + expect(await this.bitmap.$get(0, keyB)).to.be.false; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); describe('setTo', function () { it('set a key to true', async function () { await this.bitmap.$setTo(0, keyA, true); - expect(await this.bitmap.$get(0, keyA)).to.equal(true); - expect(await this.bitmap.$get(0, keyB)).to.equal(false); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.true; + expect(await this.bitmap.$get(0, keyB)).to.be.false; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); it('set a key to false', async function () { await this.bitmap.$setTo(0, keyA, true); await this.bitmap.$setTo(0, keyA, false); - expect(await this.bitmap.$get(0, keyA)).to.equal(false); - expect(await this.bitmap.$get(0, keyB)).to.equal(false); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.false; + expect(await this.bitmap.$get(0, keyB)).to.be.false; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); it('set several consecutive keys', async function () { @@ -46,39 +46,39 @@ describe('BitMap', function () { await this.bitmap.$setTo(0, keyA + 4n, true); await this.bitmap.$setTo(0, keyA + 2n, false); await this.bitmap.$setTo(0, keyA + 4n, false); - expect(await this.bitmap.$get(0, keyA + 0n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 1n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 2n)).to.equal(false); - expect(await this.bitmap.$get(0, keyA + 3n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 4n)).to.equal(false); + expect(await this.bitmap.$get(0, keyA + 0n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 1n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 2n)).to.be.false; + expect(await this.bitmap.$get(0, keyA + 3n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 4n)).to.be.false; }); }); describe('set', function () { it('adds a key', async function () { await this.bitmap.$set(0, keyA); - expect(await this.bitmap.$get(0, keyA)).to.equal(true); - expect(await this.bitmap.$get(0, keyB)).to.equal(false); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.true; + expect(await this.bitmap.$get(0, keyB)).to.be.false; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); it('adds several keys', async function () { await this.bitmap.$set(0, keyA); await this.bitmap.$set(0, keyB); - expect(await this.bitmap.$get(0, keyA)).to.equal(true); - expect(await this.bitmap.$get(0, keyB)).to.equal(true); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.true; + expect(await this.bitmap.$get(0, keyB)).to.be.true; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); it('adds several consecutive keys', async function () { await this.bitmap.$set(0, keyA + 0n); await this.bitmap.$set(0, keyA + 1n); await this.bitmap.$set(0, keyA + 3n); - expect(await this.bitmap.$get(0, keyA + 0n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 1n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 2n)).to.equal(false); - expect(await this.bitmap.$get(0, keyA + 3n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 4n)).to.equal(false); + expect(await this.bitmap.$get(0, keyA + 0n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 1n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 2n)).to.be.false; + expect(await this.bitmap.$get(0, keyA + 3n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 4n)).to.be.false; }); }); @@ -87,9 +87,9 @@ describe('BitMap', function () { await this.bitmap.$set(0, keyA); await this.bitmap.$set(0, keyB); await this.bitmap.$unset(0, keyA); - expect(await this.bitmap.$get(0, keyA)).to.equal(false); - expect(await this.bitmap.$get(0, keyB)).to.equal(true); - expect(await this.bitmap.$get(0, keyC)).to.equal(false); + expect(await this.bitmap.$get(0, keyA)).to.be.false; + expect(await this.bitmap.$get(0, keyB)).to.be.true; + expect(await this.bitmap.$get(0, keyC)).to.be.false; }); it('removes consecutive added keys', async function () { @@ -97,11 +97,11 @@ describe('BitMap', function () { await this.bitmap.$set(0, keyA + 1n); await this.bitmap.$set(0, keyA + 3n); await this.bitmap.$unset(0, keyA + 1n); - expect(await this.bitmap.$get(0, keyA + 0n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 1n)).to.equal(false); - expect(await this.bitmap.$get(0, keyA + 2n)).to.equal(false); - expect(await this.bitmap.$get(0, keyA + 3n)).to.equal(true); - expect(await this.bitmap.$get(0, keyA + 4n)).to.equal(false); + expect(await this.bitmap.$get(0, keyA + 0n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 1n)).to.be.false; + expect(await this.bitmap.$get(0, keyA + 2n)).to.be.false; + expect(await this.bitmap.$get(0, keyA + 3n)).to.be.true; + expect(await this.bitmap.$get(0, keyA + 4n)).to.be.false; }); it('adds and removes multiple keys', async function () { @@ -141,9 +141,9 @@ describe('BitMap', function () { // [A, C] - expect(await this.bitmap.$get(0, keyA)).to.equal(true); - expect(await this.bitmap.$get(0, keyB)).to.equal(false); - expect(await this.bitmap.$get(0, keyC)).to.equal(true); + expect(await this.bitmap.$get(0, keyA)).to.be.true; + expect(await this.bitmap.$get(0, keyB)).to.be.false; + expect(await this.bitmap.$get(0, keyC)).to.be.true; }); }); }); diff --git a/test/utils/structs/EnumerableMap.behavior.js b/test/utils/structs/EnumerableMap.behavior.js index 39e74a68e..37da41795 100644 --- a/test/utils/structs/EnumerableMap.behavior.js +++ b/test/utils/structs/EnumerableMap.behavior.js @@ -124,7 +124,7 @@ function shouldBehaveLikeMap() { describe('get', function () { it('existing value', async function () { - expect(await this.methods.get(this.keyA)).to.be.equal(this.valueA); + expect(await this.methods.get(this.keyA)).to.equal(this.valueA); }); it('missing value', async function () {