Check for bid status in commit and reveal phase
This commit is contained in:
parent
df804b58f6
commit
1de1a20852
@ -89,6 +89,12 @@ const createAuctionTests = () => {
|
||||
bidderAccounts[i].bid = await createBid(chainId, auctionId, bidderAccounts[i].address, `${bidAmounts[i].quantity}${bidAmounts[i].type}`);
|
||||
await registry.commitBid({ auctionId, commitHash: bidderAccounts[i].bid.commitHash }, bidderAccounts[i].privateKey, fee);
|
||||
}
|
||||
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('commit');
|
||||
auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('commit');
|
||||
});
|
||||
});
|
||||
|
||||
test('Wait for reveal phase.', (done) => {
|
||||
@ -110,6 +116,9 @@ const createAuctionTests = () => {
|
||||
test('Check bids are revealed', async () => {
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('reveal');
|
||||
auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('reveal');
|
||||
});
|
||||
|
||||
const actualBidAmounts = auction.bids.map((bid: any) => bid.bidAmount);
|
||||
expect(actualBidAmounts).toEqual(expect.arrayContaining(bidAmounts));
|
||||
@ -211,6 +220,12 @@ const createProviderAuctionTests = () => {
|
||||
bidderAccounts[i].bid = await createBid(chainId, auctionId, bidderAccounts[i].address, `${bidAmounts[i].quantity}${bidAmounts[i].type}`);
|
||||
await registry.commitBid({ auctionId, commitHash: bidderAccounts[i].bid.commitHash }, bidderAccounts[i].privateKey, fee);
|
||||
}
|
||||
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('commit');
|
||||
auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('commit');
|
||||
});
|
||||
});
|
||||
|
||||
test('Wait for reveal phase.', (done) => {
|
||||
@ -232,6 +247,9 @@ const createProviderAuctionTests = () => {
|
||||
test('Check bids are revealed', async () => {
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('reveal');
|
||||
auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('reveal');
|
||||
});
|
||||
|
||||
const actualBidAmounts = auction.bids.map((bid: any) => bid.bidAmount);
|
||||
expect(actualBidAmounts).toEqual(expect.arrayContaining(bidAmounts));
|
||||
|
Loading…
Reference in New Issue
Block a user