Skip to content

Commit

Permalink
Merge pull request #14613 from artsy/starsirius/wrong-zero-bids
Browse files Browse the repository at this point in the history
fix: do not show # of bids after lot ends
  • Loading branch information
starsirius authored Oct 4, 2024
2 parents 9c510c7 + eb84e04 commit e6b4534
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/Components/Artwork/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,17 @@ const BidInfo: React.FC<DetailsProps> = ({
return null
}

const bidderPositionCounts = sale_artwork?.counts?.bidder_positions ?? 0
const bidCount = collectorSignals?.auction?.bidCount ?? 0
const bidCount = signalsAuctionEnabled
? collectorSignals?.auction?.bidCount ?? 0
: sale_artwork?.counts?.bidder_positions ?? 0

if (bidCount === 0 && bidderPositionCounts === 0) {
if (bidCount === 0) {
return null
}

return (
<>
{signalsAuctionEnabled ? (
<>
({bidCount} bid{bidCount === 1 ? "" : "s"})
</>
) : (
<>
({bidderPositionCounts} bid{bidderPositionCounts === 1 ? "" : "s"})
</>
)}
({bidCount} bid{bidCount === 1 ? "" : "s"})
</>
)
}
Expand Down
22 changes: 22 additions & 0 deletions src/Components/Artwork/Details/__tests__/Details.jest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,28 @@ describe("Details", () => {

expect(html).toContain("Increased Interest")
})

it("does not show the number of bids when there are bids on the sale artwork but no auction signals", async () => {
const data: any = {
...artworkInAuction,
collectorSignals: {
...artworkInAuction?.collectorSignals,
auction: null,
},
sale_artwork: {
...artworkInAuction?.sale_artwork,
counts: {
...artworkInAuction?.sale_artwork?.counts,
bidder_positions: 2,
},
},
}

const wrapper = await getWrapper(data)
const html = wrapper.html()
expect(html).toContain("$2,600")
expect(html).not.toMatch(/\d+ bids?/)
})
})
})

Expand Down

0 comments on commit e6b4534

Please sign in to comment.