Skip to content

Commit

Permalink
Add the missing test for ERC721Holder (#1249)
Browse files Browse the repository at this point in the history
* Add the missing test for ERC721Holder

* fix lint

* Move the holder test to a separate file

(cherry picked from commit 396680b)
  • Loading branch information
Leo Arias authored and frangio committed Sep 26, 2018
1 parent e7c99dd commit c9e8a66
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/token/ERC721/ERC721Holder.test.js
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit c9e8a66

Please sign in to comment.