From c2c5c353a6d2ce6e0a35625160eb0bff38746de4 Mon Sep 17 00:00:00 2001 From: devon blandin Date: Wed, 9 Oct 2024 17:51:20 +0200 Subject: [PATCH] chore(analytics): update default view all behavior for auction results section (#10920) --- .../HomeViewSectionAuctionResults.tests.tsx | 41 +++++++++++++++++-- .../HomeViewSectionAuctionResults.tsx | 6 ++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tests.tsx b/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tests.tsx index e557e905ed3..3119c9ae9ff 100644 --- a/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tests.tsx +++ b/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tests.tsx @@ -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", @@ -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: { @@ -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": "", + "context_screen_owner_type": "home", + "destination_screen_owner_type": "auctionResultsForArtistsYouFollow", + "type": "viewAll", + }, + ] + `) + expect(navigate).toHaveBeenCalledWith("/auction-results-for-artists-you-follow") }) }) diff --git a/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tsx b/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tsx index 530406db56d..c01300c5400 100644 --- a/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tsx +++ b/src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tsx @@ -64,9 +64,13 @@ export const HomeViewSectionAuctionResults: React.FC behaviors > viewAll > ownerType` value. tracking.tappedAuctionResultGroupViewAll( section.contextModule as ContextModule, - OwnerType.lotsByArtistsYouFollow + OwnerType.auctionResultsForArtistsYouFollow ) navigate("/auction-results-for-artists-you-follow")