diff --git a/contracts/token/ERC721/ERC721.sol b/contracts/token/ERC721/ERC721.sol index e71905c56..643d6706f 100644 --- a/contracts/token/ERC721/ERC721.sol +++ b/contracts/token/ERC721/ERC721.sol @@ -86,7 +86,7 @@ contract ERC721 is ERC165, IERC721 { */ function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); - require(to != owner, "ERC721: transfer to current owner"); + require(to != owner, "ERC721: approval to current owner"); require(msg.sender == owner || isApprovedForAll(owner, msg.sender), "ERC721: approve caller is not owner nor approved for all" diff --git a/test/token/ERC20/behaviors/ERC20Capped.behavior.js b/test/token/ERC20/behaviors/ERC20Capped.behavior.js index e3efff11c..9c722a695 100644 --- a/test/token/ERC20/behaviors/ERC20Capped.behavior.js +++ b/test/token/ERC20/behaviors/ERC20Capped.behavior.js @@ -15,12 +15,12 @@ function shouldBehaveLikeERC20Capped (minter, [other], cap) { it('should fail to mint if the amount exceeds the cap', async function () { await this.token.mint(other, cap.subn(1), { from }); - await shouldFail.reverting.withMessage(this.token.mint(other, 2, { from })); + await shouldFail.reverting.withMessage(this.token.mint(other, 2, { from }), 'ERC20Capped: cap exceeded'); }); it('should fail to mint after cap is reached', async function () { await this.token.mint(other, cap, { from }); - await shouldFail.reverting.withMessage(this.token.mint(other, 1, { from })); + await shouldFail.reverting.withMessage(this.token.mint(other, 1, { from }), 'ERC20Capped: cap exceeded'); }); }); } diff --git a/test/token/ERC721/ERC721.behavior.js b/test/token/ERC721/ERC721.behavior.js index 673e52be2..efe077cd8 100644 --- a/test/token/ERC721/ERC721.behavior.js +++ b/test/token/ERC721/ERC721.behavior.js @@ -315,9 +315,8 @@ function shouldBehaveLikeERC721 ( describe('to a contract that does not implement the required function', function () { it('reverts', async function () { const invalidReceiver = this.token; - await shouldFail.reverting.withMessage( - this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner }), - 'VM Exception while processing transaction: revert' + await shouldFail.reverting( + this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner }) ); }); }); @@ -406,7 +405,7 @@ function shouldBehaveLikeERC721 ( context('when the address that receives the approval is the owner', function () { it('reverts', async function () { await shouldFail.reverting.withMessage( - this.token.approve(owner, tokenId, { from: owner }), 'ERC721: transfer to current owner' + this.token.approve(owner, tokenId, { from: owner }), 'ERC721: approval to current owner' ); }); });