Make txs in parallel in auction tests to reduce run time #30
@ -67,10 +67,13 @@ const auctionTests = () => {
|
|||||||
test('Commit bids.', async () => {
|
test('Commit bids.', async () => {
|
||||||
for (let i = 0; i < numBidders; i++) {
|
for (let i = 0; i < numBidders; i++) {
|
||||||
bidAmounts.push((LOWEST_BID_AMOUNT + (i * 500)).toString());
|
bidAmounts.push((LOWEST_BID_AMOUNT + (i * 500)).toString());
|
||||||
bidderAccounts[i].bid = await createBid(chainId, auctionId, bidderAccounts[i].address, `${bidAmounts[i]}${DENOM}`);
|
|
||||||
await registry.commitBid({ auctionId, commitHash: bidderAccounts[i].bid.commitHash }, bidderAccounts[i].privateKey, fee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Promise.all(bidderAccounts.map(async (bidderAccount, i) => {
|
||||||
|
bidderAccounts[i].bid = await createBid(chainId, auctionId, bidderAccount.address, `${bidAmounts[i]}${DENOM}`);
|
||||||
|
return registry.commitBid({ auctionId, commitHash: bidderAccount.bid.commitHash }, bidderAccount.privateKey, fee);
|
||||||
|
}));
|
||||||
|
|
||||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||||
expect(auction.status).toEqual('commit');
|
expect(auction.status).toEqual('commit');
|
||||||
expect(auction.bids.length).toEqual(3);
|
expect(auction.bids.length).toEqual(3);
|
||||||
@ -90,9 +93,9 @@ const auctionTests = () => {
|
|||||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||||
expect(auction.status).toEqual('reveal');
|
expect(auction.status).toEqual('reveal');
|
||||||
|
|
||||||
for (let i = 0; i < numBidders; i++) {
|
await Promise.all(bidderAccounts.map(async bidderAccount => {
|
||||||
await registry.revealBid({ auctionId, reveal: bidderAccounts[i].bid.revealString }, bidderAccounts[i].privateKey, fee);
|
return registry.revealBid({ auctionId, reveal: bidderAccount.bid.revealString }, bidderAccount.privateKey, fee);
|
||||||
}
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Check bids are revealed', async () => {
|
test('Check bids are revealed', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user