Files
openzeppelin-contracts/test/token/ERC721/utils/ERC721Holder.test.js
github-actions edf6031131 Update docs
2024-10-21 14:27:36 +00:00

21 lines
623 B
JavaScript

const { ethers } = require('hardhat');
const { expect } = require('chai');
const name = 'Non Fungible Token';
const symbol = 'NFT';
const tokenId = 1n;
describe('ERC721Holder', function () {
it('receives an ERC721 token', async function () {
const [owner] = await ethers.getSigners();
const token = await ethers.deployContract('$ERC721', [name, symbol]);
await token.$_mint(owner, tokenId);
const receiver = await ethers.deployContract('$ERC721Holder');
await token.connect(owner).safeTransferFrom(owner, receiver, tokenId);
expect(await token.ownerOf(tokenId)).to.equal(receiver);
});
});