-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(BidSnapshot): L3-4690 changed prop
- Loading branch information
1 parent
97fb256
commit 92c7a2f
Showing
8 changed files
with
42 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,43 @@ | ||
import BidSnapshot from './BidSnapshot'; | ||
import { runCommonTests } from '../../utils/testUtils'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { AuctionStatus } from '../../types/commonTypes'; | ||
import { LotStatus } from '../../types/commonTypes'; | ||
|
||
describe('BidSnapshot', () => { | ||
runCommonTests(BidSnapshot, 'BidSnapshot'); | ||
|
||
it('renders starting bid when there is only one bid and auction is not past', () => { | ||
render(<BidSnapshot startingBid={100} auctionStatus={AuctionStatus.ready} />); | ||
render(<BidSnapshot startingBid={100} lotStatus={LotStatus.ready} />); | ||
expect(screen.getByText('Starting bid')).toBeInTheDocument(); | ||
expect(screen.getByText('$100')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders current bid when there are multiple bids and auction is not past', () => { | ||
render(<BidSnapshot startingBid={100} numberOfBids={3} auctionStatus={AuctionStatus.live} currentBid={300} />); | ||
render(<BidSnapshot startingBid={100} numberOfBids={3} lotStatus={LotStatus.live} currentBid={300} />); | ||
expect(screen.getByText('Current bid')).toBeInTheDocument(); | ||
expect(screen.getByText('$300')).toBeInTheDocument(); | ||
expect(screen.getByText('(3 bids)')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders won for when auction is past and active bid is the last bid', () => { | ||
render( | ||
<BidSnapshot | ||
startingBid={100} | ||
currentBid={300} | ||
numberOfBids={3} | ||
auctionStatus={AuctionStatus.past} | ||
activeBid={300} | ||
/>, | ||
<BidSnapshot startingBid={100} currentBid={300} numberOfBids={3} lotStatus={LotStatus.past} activeBid={300} />, | ||
); | ||
expect(screen.getByText('Won for')).toBeInTheDocument(); | ||
expect(screen.getByText('$300')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders sold for when auction is past and active bid is not the last bid', () => { | ||
render( | ||
<BidSnapshot | ||
startingBid={100} | ||
numberOfBids={3} | ||
currentBid={300} | ||
auctionStatus={AuctionStatus.past} | ||
activeBid={200} | ||
/>, | ||
<BidSnapshot startingBid={100} numberOfBids={3} currentBid={300} lotStatus={LotStatus.past} activeBid={200} />, | ||
); | ||
expect(screen.getByText('Sold for')).toBeInTheDocument(); | ||
expect(screen.getByText('$300')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders Countdown timer when lotCloseDate prop is passed', () => { | ||
const lotCloseDate = new Date(Date.now() + 10000); // 10 seconds from now | ||
render( | ||
<BidSnapshot startingBid={100} numberOfBids={1} auctionStatus={AuctionStatus.live} lotCloseDate={lotCloseDate} />, | ||
); | ||
render(<BidSnapshot startingBid={100} numberOfBids={1} lotStatus={LotStatus.live} lotCloseDate={lotCloseDate} />); | ||
expect(screen.getByText('Closes in')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters