Commit 635a3814 by Jatin Kathuria Committed by Nicolás Venturo

Fix Part 1 : added tests for getApproved (#1820)

* added tests for getApproved

* added tests for getApproved

* added to changelog

* Corrected some linting issues

* Removed unneccrary tests as pointed out here: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1820/commits/b49c2de086621745955be83a34a06de65e95c76c#r307927816

* Correct Changelog character

* Update ERC721.behavior.js
parent 4e527a20
...@@ -586,6 +586,35 @@ function shouldBehaveLikeERC721 ( ...@@ -586,6 +586,35 @@ function shouldBehaveLikeERC721 (
}); });
}); });
describe('getApproved', async function () {
context('when token is not minted', async function () {
it('reverts', async function () {
await expectRevert(
this.token.getApproved(unknownTokenId, { from: minter }),
'ERC721: approved query for nonexistent token'
);
});
});
context('when token has been minted ', async function () {
it('should return the zero address', async function () {
expect(await this.token.getApproved(firstTokenId)).to.be.equal(
ZERO_ADDRESS
);
});
context('when account has been approved', async function () {
beforeEach(async function () {
await this.token.approve(approved, firstTokenId, { from: owner });
});
it('should return approved account', async function () {
expect(await this.token.getApproved(firstTokenId)).to.be.equal(approved);
});
});
});
});
shouldSupportInterfaces([ shouldSupportInterfaces([
'ERC165', 'ERC165',
'ERC721', 'ERC721',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment