-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement shared 1155URI tests.
- Loading branch information
Showing
6 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
contracts/mocks/token/ERC1155/MockERC1155ConfigurableURI.sol
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.19; | ||
|
||
import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; | ||
|
||
contract MockERC1155ConfigurableURI is ERC1155 { | ||
constructor(string memory __URI) ERC1155(__URI) {} | ||
|
||
function mint(uint256 itemId, uint256 quantity) public { | ||
_mint(msg.sender, itemId, quantity, ''); | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as dotenv from 'dotenv'; | ||
import hre from 'hardhat'; | ||
|
||
import { addHardhatSignersToContext, shouldDefine1155URI } from '../../../../src'; | ||
import { MockERC1155ConfigurableURI, MockERC1155ConfigurableURI__factory } from '../../../../typechain-types'; | ||
|
||
dotenv.config(); | ||
|
||
const TESTHARNESS_CONTRACT_NAME = 'MockERC1155ConfigurableURI'; | ||
|
||
let _testHarnessContractFactory: MockERC1155ConfigurableURI__factory; | ||
let _testHarnessInstance: MockERC1155ConfigurableURI; | ||
|
||
// Some plausibly real ERC1155 URI | ||
const ERC1155URI = 'https://nftculture.mypinata.com/ipfs/Qm000abcdefghijkl/{id}.json'; | ||
|
||
// Start test block | ||
describe(`${TESTHARNESS_CONTRACT_NAME} Unit Tests`, function () { | ||
before(async function () { | ||
_testHarnessContractFactory = await hre.ethers.getContractFactory(TESTHARNESS_CONTRACT_NAME); | ||
}); | ||
|
||
beforeEach(async function () { | ||
_testHarnessInstance = await _testHarnessContractFactory.deploy(ERC1155URI); | ||
await _testHarnessInstance.deployed(); | ||
this.contractUnderTest = _testHarnessInstance; | ||
}); | ||
|
||
addHardhatSignersToContext(); | ||
|
||
shouldDefine1155URI(TESTHARNESS_CONTRACT_NAME, async () => ERC1155URI); | ||
}); |
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