Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions test/EnglishAuction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,26 @@ describe('EnglishAuction', function () {
5,
10,
),
).to.be.revertedWith('Name must be present');
).to.be.revertedWith('String must not be empty');
});

it('should reject auction creation with empty auctioned token address', async function () {
// Attempt to create an auction with ZeroAddress for auctionedToken
await expect(
englishAuction.connect(auctioneer).createAuction(
'Test Auction',
'Description',
'https://example.com/image.jpg',
0, // NFT type
ethers.ZeroAddress, // auctionedToken zero address check
1, // tokenId
await biddingToken.getAddress(), // bidding token
ethers.parseEther('1'),
ethers.parseEther('0.1'),
5,
10,
),
).to.be.revertedWith('Address must not be zero'); // Matches nonZeroAddress modifier
});

it('should reject auction creation with empty bidding token address', async function () {
Expand All @@ -142,13 +161,13 @@ describe('EnglishAuction', function () {
0,
mockNFT.getAddress(),
1,
ZeroAddress, // empty bidding token address
ZeroAddress, // zero address
ethers.parseEther('1'),
ethers.parseEther('0.1'),
5,
10,
),
).to.be.revertedWith('Bidding token address must be provided');
).to.be.revertedWith('Address must not be zero'); // Updated Revert String
});
});

Expand Down Expand Up @@ -262,11 +281,13 @@ describe('EnglishAuction', function () {
await ethers.provider.send('evm_increaseTime', [20]);
await ethers.provider.send('evm_mine', []);

// Winner claims auctioned item
// First claim succeeds
await englishAuction.connect(bidder1).claim(0);

// Attempt to claim again
await expect(englishAuction.connect(bidder1).claim(0)).to.be.revertedWith('Auction had been settled');
// Second claim should revert
await expect(
englishAuction.connect(bidder1).claim(0)
).to.be.revertedWith('Auctioned asset has already been claimed'); // Updated Revert String
});
});

Expand Down