Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/token/ERC721/ERC721BasicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {

/**
* @dev Gets the approved address for a token ID, or zero if no address set
* Reverts if the token ID does not exist
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 _tokenId) public view returns (address) {
require(_exists(_tokenId));
return tokenApprovals[_tokenId];
}

Expand Down
6 changes: 4 additions & 2 deletions test/token/ERC721/ERC721MintBurn.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ function shouldBehaveLikeMintAndBurnERC721Token (accounts) {
logs = result.logs;
});

it('clears the approval', async function () {
(await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
context('when the token ID does not exist', function () {
it('reverts', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the current phrasing a bit confusing: maybe we could merge the context and it blocks, and change the description to something like 'causes getApproved to revert'?

We also may want to add a test block for getApproved, explicitly checking for this, though that could be considered part of #1148.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nventuro I made a quick attempt at clarifying the descriptions. And added a comment on #1148 to not forget about the getApproved tests.

await assertRevert(this.token.getApproved(tokenId));
});
});
});

Expand Down