Skip to content

Commit

Permalink
chore(analytics): update default view all behavior for auction result…
Browse files Browse the repository at this point in the history
…s section (#10920)
  • Loading branch information
dblandin authored Oct 9, 2024
1 parent c6abd2d commit c2c5c35
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe("HomeViewSectionAuctionResults", () => {
expect(navigate).toHaveBeenCalledWith("/artist/artist-2/auction-result/auction-result-2-id")
})

it("navigates to ViewAll when the user taps the 'View All' button", () => {
it("navigates to requested `href` destination when the user taps the 'View All' button", () => {
renderWithRelay({
HomeViewSectionAuctionResults: () => ({
internalID: "home-view-section-latest-auction-results",
Expand All @@ -111,7 +111,7 @@ describe("HomeViewSectionAuctionResults", () => {
behaviors: {
viewAll: {
buttonText: "View All",
href: "/auction-results-for-artists-you-follow-view-all-href",
href: "/example-href",
},
},
auctionResultsConnection: {
Expand All @@ -130,6 +130,41 @@ describe("HomeViewSectionAuctionResults", () => {
expect(screen.getByText("View All")).toBeOnTheScreen()
fireEvent.press(screen.getByText("View All"))

expect(navigate).toHaveBeenCalledWith("/auction-results-for-artists-you-follow-view-all-href")
expect(navigate).toHaveBeenCalledWith("/example-href")
})

it("navigates to default View All implementation when `href` is unspecified and the user taps the 'View All' button", () => {
renderWithRelay({
HomeViewSectionAuctionResults: () => ({
internalID: "home-view-section-latest-auction-results",
component: {
title: "Latest Auction Results",
href: "/auction-results-for-artists-you-follow-href",
behaviors: {
viewAll: {
buttonText: "View All",
href: null,
},
},
auctionResultsConnection: {},
},
}),
})

expect(screen.getByText("View All")).toBeOnTheScreen()
fireEvent.press(screen.getByText("View All"))

expect(mockTrackEvent.mock.calls[0]).toMatchInlineSnapshot(`
[
{
"action": "tappedAuctionResultGroup",
"context_module": "<mock-value-for-field-"contextModule">",
"context_screen_owner_type": "home",
"destination_screen_owner_type": "auctionResultsForArtistsYouFollow",
"type": "viewAll",
},
]
`)
expect(navigate).toHaveBeenCalledWith("/auction-results-for-artists-you-follow")
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ export const HomeViewSectionAuctionResults: React.FC<HomeViewSectionAuctionResul

navigate(viewAll.href)
} else {
// TODO: This default view all behavior navigates to the existing Auction
// "Results From Artists You Follow" screen. This should eventually be
// updated to navigate to a HomeViewSectionAuctionResults screen and we can
// use the `component > behaviors > viewAll > ownerType` value.
tracking.tappedAuctionResultGroupViewAll(
section.contextModule as ContextModule,
OwnerType.lotsByArtistsYouFollow
OwnerType.auctionResultsForArtistsYouFollow
)

navigate("/auction-results-for-artists-you-follow")
Expand Down

0 comments on commit c2c5c35

Please sign in to comment.