Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Jul 12, 2022
1 parent 719a164 commit 696c0de
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test/extensions/ERC4907A.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
});

Expand Down Expand Up @@ -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');
});
Expand All @@ -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');
});
});
});
Expand Down

0 comments on commit 696c0de

Please sign in to comment.