From 696c0de7bc3136f6caf3dd6fc54ff4f7b0b57a9a Mon Sep 17 00:00:00 2001 From: Vectorized Date: Tue, 12 Jul 2022 22:31:23 +0000 Subject: [PATCH] More tests --- test/extensions/ERC4907A.test.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/extensions/ERC4907A.test.js b/test/extensions/ERC4907A.test.js index f2b911954..10dab94ca 100644 --- a/test/extensions/ERC4907A.test.js +++ b/test/extensions/ERC4907A.test.js @@ -75,9 +75,8 @@ const createTestSuite = ({ contract, constructorArgs }) => this.setupAuthTest = async () => { this.tokenId = 0; - await expect( - this.setUser() - ).to.be.revertedWith('SetUserCallerNotOwnerNorApproved'); + await expect(this.setUser()) + .to.be.revertedWith('SetUserCallerNotOwnerNorApproved'); }; }); @@ -178,18 +177,15 @@ const createTestSuite = ({ contract, constructorArgs }) => }); it('does not emits UpdateUser event if not set', async function () { - this.transferTx = await this.erc4097a.connect(this.addr1) - .transferFrom(this.addr1.address, this.owner.address, this.tokenId); - - await expect(await this.transferTx) - .to.not.emit(this.erc4097a, 'UpdateUser'); - - await this.erc4097a.connect(this.owner) + await this.erc4097a.connect(this.addr1) .setUser(this.tokenId, this.user.address, this.expires); - await this.erc4097a.connect(this.owner) + await this.erc4097a.connect(this.addr1) .setUser(this.tokenId, ZERO_ADDRESS, 0); + this.transferTx = await this.erc4097a.connect(this.addr1) + .transferFrom(this.addr1.address, this.owner.address, this.tokenId); + await expect(await this.transferTx) .to.not.emit(this.erc4097a, 'UpdateUser'); }); @@ -204,10 +200,10 @@ const createTestSuite = ({ contract, constructorArgs }) => it('minting does not emits UpdateUser event', async function () { this.mintTx = await this.erc4097a['safeMint(address,uint256)'](this.owner.address, 1); - await expect(await this.transferTx).to.not.emit(this.erc4097a, 'UpdateUser'); + await expect(await this.mintTx).to.not.emit(this.erc4097a, 'UpdateUser'); this.mintTx = await this.erc4097a['safeMint(address,uint256)'](this.owner.address, 2); - await expect(await this.transferTx).to.not.emit(this.erc4097a, 'UpdateUser'); + await expect(await this.mintTx).to.not.emit(this.erc4097a, 'UpdateUser'); }); }); });