Add the missing test for ERC721Holder (#1249)

* Add the missing test for ERC721Holder

* fix lint

* Move the holder test to a separate file

(cherry picked from commit 396680b856)
This commit is contained in:
Leo Arias
2018-09-26 09:00:08 -06:00
committed by Francisco Giordano
parent e7c99dd7dd
commit c9e8a66e85

View File

@ -0,0 +1,19 @@
const ERC721Holder = artifacts.require('ERC721Holder.sol');
const ERC721Mintable = artifacts.require('ERC721MintableBurnableImpl.sol');
require('chai')
.should();
contract('ERC721Holder', function ([creator]) {
it('receives an ERC721 token', async function () {
const token = await ERC721Mintable.new({ from: creator });
const tokenId = 1;
await token.mint(creator, tokenId, { from: creator });
const receiver = await ERC721Holder.new();
await token.approve(receiver.address, tokenId, { from: creator });
await token.safeTransferFrom(creator, receiver.address, tokenId);
(await token.ownerOf(tokenId)).should.be.equal(receiver.address);
});
});