Add methods for creating auctions and add auction tests #28

Merged
nabarun merged 32 commits from deep-stack/registry-sdk:iv-create-auction-test into main 2024-09-25 13:21:05 +00:00
Showing only changes of commit 965b2ba2af - Show all commits

View File

@ -13,7 +13,6 @@ const creatorInitialBalance = 1000000000000;
const bidderInitialBalance = 20000000; const bidderInitialBalance = 20000000;
const lowestBidAmount = 10000000; const lowestBidAmount = 10000000;
// TODO: Check exact balances by subtracting the fees
const auctionTests = () => { const auctionTests = () => {
let registry: Registry; let registry: Registry;
let auctionId: string; let auctionId: string;
@ -116,10 +115,10 @@ const auctionTests = () => {
const [{ type, quantity }] = bidderrAccountObj.balance; const [{ type, quantity }] = bidderrAccountObj.balance;
const actualBalance = parseInt(quantity); 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(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 // Balance should be less than bidder's initial balance - winning price as tx fees also gets deducted
const [{ type, quantity }] = winnerAccountObj.balance; const [{ type, quantity }] = winnerAccountObj.balance;
expect(type).toBe(DENOM); 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) => { const providerAuctionTestsWithBids = (bidAmounts: number[], numProviders: number) => {
let registry: Registry; let registry: Registry;
let auctionId: string; let auctionId: string;