forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ERC721 tests (OpenZeppelin#4793)
Co-authored-by: ernestognw <ernestognw@gmail.com>
- Loading branch information
1 parent
88512b2
commit 88211e8
Showing
11 changed files
with
955 additions
and
1,023 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
const { ethers } = require('hardhat'); | ||
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); | ||
|
||
const { shouldBehaveLikeERC721, shouldBehaveLikeERC721Metadata } = require('./ERC721.behavior'); | ||
|
||
const ERC721 = artifacts.require('$ERC721'); | ||
const name = 'Non Fungible Token'; | ||
const symbol = 'NFT'; | ||
|
||
contract('ERC721', function (accounts) { | ||
const name = 'Non Fungible Token'; | ||
const symbol = 'NFT'; | ||
async function fixture() { | ||
return { | ||
accounts: await ethers.getSigners(), | ||
token: await ethers.deployContract('$ERC721', [name, symbol]), | ||
}; | ||
} | ||
|
||
describe('ERC721', function () { | ||
beforeEach(async function () { | ||
this.token = await ERC721.new(name, symbol); | ||
Object.assign(this, await loadFixture(fixture)); | ||
}); | ||
|
||
shouldBehaveLikeERC721(...accounts); | ||
shouldBehaveLikeERC721Metadata(name, symbol, ...accounts); | ||
shouldBehaveLikeERC721(); | ||
shouldBehaveLikeERC721Metadata(name, symbol); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
const { ethers } = require('hardhat'); | ||
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); | ||
|
||
const { | ||
shouldBehaveLikeERC721, | ||
shouldBehaveLikeERC721Metadata, | ||
shouldBehaveLikeERC721Enumerable, | ||
} = require('./ERC721.behavior'); | ||
|
||
const ERC721Enumerable = artifacts.require('$ERC721Enumerable'); | ||
const name = 'Non Fungible Token'; | ||
const symbol = 'NFT'; | ||
|
||
contract('ERC721Enumerable', function (accounts) { | ||
const name = 'Non Fungible Token'; | ||
const symbol = 'NFT'; | ||
async function fixture() { | ||
return { | ||
accounts: await ethers.getSigners(), | ||
token: await ethers.deployContract('$ERC721Enumerable', [name, symbol]), | ||
}; | ||
} | ||
|
||
describe('ERC721', function () { | ||
beforeEach(async function () { | ||
this.token = await ERC721Enumerable.new(name, symbol); | ||
Object.assign(this, await loadFixture(fixture)); | ||
}); | ||
|
||
shouldBehaveLikeERC721(...accounts); | ||
shouldBehaveLikeERC721Metadata(name, symbol, ...accounts); | ||
shouldBehaveLikeERC721Enumerable(...accounts); | ||
shouldBehaveLikeERC721(); | ||
shouldBehaveLikeERC721Metadata(name, symbol); | ||
shouldBehaveLikeERC721Enumerable(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.