Fix remaining revert reasons.
This commit is contained in:
@ -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"
|
||||
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -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'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user