-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update FixedPriceAllowedMintersStrategy.test.ts
- Loading branch information
1 parent
09eacb7
commit f493c9f
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
packages/1155-contracts/test/minters/fixed-price/FixedPriceAllowedMintersStrategy.test.ts
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 +1,58 @@ | ||
import { expect } from "chai"; | ||
import { ethers } from "hardhat"; | ||
import { time } from "@nomicfoundation/hardhat-network-helpers"; | ||
import { FixedPriceAllowedMintersStrategy } from "../../../typechain-types"; | ||
|
||
describe("FixedPriceAllowedMintersStrategy", () => { | ||
let fixedPriceMinter: FixedPriceAllowedMintersStrategy; | ||
|
||
beforeEach(async () => { | ||
const FixedPriceMinter = await ethers.getContractFactory("FixedPriceAllowedMintersStrategy"); | ||
fixedPriceMinter = await FixedPriceMinter.deploy(); | ||
await fixedPriceMinter.deployed(); | ||
}); | ||
|
||
describe("setSale", () => { | ||
it("should set sale with valid time window", async () => { | ||
const now = await time.latest(); | ||
const saleConfig = { | ||
saleStart: now + 100, | ||
saleEnd: now + 1000, | ||
maxTokensPerAddress: 5, | ||
pricePerToken: ethers.utils.parseEther("0.1"), | ||
fundsRecipient: ethers.constants.AddressZero | ||
}; | ||
|
||
await expect(fixedPriceMinter.setSale(1, saleConfig)) | ||
.to.emit(fixedPriceMinter, "SaleSet"); | ||
}); | ||
|
||
it("should revert when saleEnd is before saleStart", async () => { | ||
const now = await time.latest(); | ||
const saleConfig = { | ||
saleStart: now + 1000, | ||
saleEnd: now + 100, | ||
maxTokensPerAddress: 5, | ||
pricePerToken: ethers.utils.parseEther("0.1"), | ||
fundsRecipient: ethers.constants.AddressZero | ||
}; | ||
|
||
await expect(fixedPriceMinter.setSale(1, saleConfig)) | ||
.to.be.revertedWithCustomError(fixedPriceMinter, "InvalidSaleTime"); | ||
}); | ||
|
||
it("should revert when saleStart equals saleEnd", async () => { | ||
const now = await time.latest(); | ||
const saleConfig = { | ||
saleStart: now + 100, | ||
saleEnd: now + 100, | ||
maxTokensPerAddress: 5, | ||
pricePerToken: ethers.utils.parseEther("0.1"), | ||
fundsRecipient: ethers.constants.AddressZero | ||
}; | ||
|
||
await expect(fixedPriceMinter.setSale(1, saleConfig)) | ||
.to.be.revertedWithCustomError(fixedPriceMinter, "InvalidSaleTime"); | ||
}); | ||
}); | ||
}); |