From 965b2ba2afea4dab8461bde91ef90dbca6d1c8bb Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 23 Sep 2024 09:31:32 +0530 Subject: [PATCH] Add checks for exact bidder balances --- src/auction.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/auction.test.ts b/src/auction.test.ts index 077e055..242727d 100644 --- a/src/auction.test.ts +++ b/src/auction.test.ts @@ -13,7 +13,6 @@ const creatorInitialBalance = 1000000000000; const bidderInitialBalance = 20000000; const lowestBidAmount = 10000000; -// TODO: Check exact balances by subtracting the fees const auctionTests = () => { let registry: Registry; let auctionId: string; @@ -116,10 +115,10 @@ const auctionTests = () => { const [{ type, quantity }] = bidderrAccountObj.balance; const actualBalance = parseInt(quantity); - const expectedBalance = bidderInitialBalance - parseInt(bidAmounts[i]); + const expectedBalance = bidderInitialBalance - parseInt(bidAmounts[i]) - 400000 - parseInt(commitFee) - parseInt(revealFee); expect(type).toBe(DENOM); - expect(actualBalance).toBeLessThan(expectedBalance); + expect(actualBalance).toBe(expectedBalance); } }); @@ -151,10 +150,11 @@ const auctionTests = () => { // Balance should be less than bidder's initial balance - winning price as tx fees also gets deducted const [{ type, quantity }] = winnerAccountObj.balance; expect(type).toBe(DENOM); - expect(parseInt(quantity)).toBeLessThan(bidderInitialBalance - winningPriceAmount - 400000); + expect(parseInt(quantity)).toBe(bidderInitialBalance - winningPriceAmount - 400000 - parseInt(commitFee)); }); }; +// TODO: Check exact balances by subtracting the fees const providerAuctionTestsWithBids = (bidAmounts: number[], numProviders: number) => { let registry: Registry; let auctionId: string;