Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olerichter00 committed Apr 29, 2024
1 parent 89bebfa commit dacdeeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const Specialist: React.FC<SpecialistProps> = ({ specialist, onInquiryPress }) =
<Button
size="small"
variant="outlineLight"
testID="MeetTheSpecialists-contact-CTA"
onPress={() => {
onInquiryPress(
tracks.consignmentInquiryTapped(buttonText),
Expand Down
26 changes: 2 additions & 24 deletions src/app/Scenes/SellWithArtsy/SellWithArtsyHome.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
ActionType,
ContextModule,
OwnerType,
tappedConsign,
TappedConsignArgs,
TappedConsignmentInquiry,
} from "@artsy/cohesion"
import { tappedConsign, TappedConsignArgs, TappedConsignmentInquiry } from "@artsy/cohesion"
import { Flex, Join, LegacyScreen, Spacer } from "@artsy/palette-mobile"
import { SellWithArtsyHomeQuery } from "__generated__/SellWithArtsyHomeQuery.graphql"
import { SellWithArtsyHome_me$data } from "__generated__/SellWithArtsyHome_me.graphql"
Expand All @@ -15,6 +8,7 @@ import { FAQSWA } from "app/Scenes/SellWithArtsy/Components/FAQSWA"
import { Highlights } from "app/Scenes/SellWithArtsy/Components/Highlights"
import { MeetTheSpecialists } from "app/Scenes/SellWithArtsy/Components/MeetTheSpecialists"
import { SpeakToTheTeam } from "app/Scenes/SellWithArtsy/Components/SpeakToTheTeam"
import { StickySWAHeader } from "app/Scenes/SellWithArtsy/Components/StickySWAHeader"
import { Testimonials } from "app/Scenes/SellWithArtsy/Components/Testimonials"
import { WaysWeSell } from "app/Scenes/SellWithArtsy/Components/WaysWeSell"
import { GlobalStore } from "app/store/GlobalStore"
Expand All @@ -32,7 +26,6 @@ import { Footer } from "./Components/Footer"
import { Header } from "./Components/Header"
import { HowItWorks } from "./Components/HowItWorks"
import { SellWithArtsyRecentlySold } from "./Components/SellWithArtsyRecentlySold"
import { StickySWAHeader } from "app/Scenes/SellWithArtsy/Components/StickySWAHeader"

interface SellWithArtsyHomeProps {
recentlySoldArtworks?: SellWithArtsyHome_recentlySoldArtworksTypeConnection$data
Expand Down Expand Up @@ -185,18 +178,3 @@ export const SellWithArtsyHomeQueryRenderer: React.FC<SellWithArtsyHomeQueryRend
/>
)
}

const tracks = {
consignArgs: (subject: string): TappedConsignArgs => ({
contextModule: ContextModule.sellHeader,
contextScreenOwnerType: OwnerType.sell,
subject,
}),
consignmentInquiryTapped: (): TappedConsignmentInquiry => ({
action: ActionType.tappedConsignmentInquiry,
context_module: ContextModule.sellHeader,
context_screen: OwnerType.sell,
context_screen_owner_type: OwnerType.sell,
subject: "Get in Touch",
}),
}
26 changes: 3 additions & 23 deletions src/app/Scenes/SellWithArtsy/index.tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,37 +76,17 @@ describe("New SellWithArtsyLandingPage", () => {

it("tracks Inquiry Events", () => {
renderWithWrappers(<TestWrapper />)
const headerInquiryButton = screen.getByTestId("Header-inquiry-CTA")
const headerInquiryButton = screen.getByTestId("MeetTheSpecialists-contact-CTA")

fireEvent(headerInquiryButton, "onPress")
expect(mockTrackEvent).toHaveBeenCalledTimes(1)
expect(mockTrackEvent).toHaveBeenLastCalledWith(
expect.objectContaining({
action: "tappedConsignmentInquiry",
context_module: "sellHeader",
context_module: "sellMeetTheSpecialists",
context_screen: "sell",
context_screen_owner_type: "sell",
subject: "Get in Touch",
})
)
})
})

// HOWITWORKS
describe("HowItWorks Events", () => {
it("tracks Consign Events", () => {
renderWithWrappers(<TestWrapper />)
const headerConsignButton = screen.getByTestId("HowItWorks-consign-CTA")

fireEvent(headerConsignButton, "onPress")
expect(mockTrackEvent).toHaveBeenCalledTimes(1)
expect(mockTrackEvent).toHaveBeenLastCalledWith(
expect.objectContaining({
action: "tappedConsign",
context_module: "sellHowItWorks",
context_screen_owner_type: "sell",
destination_screen_owner_type: "consignmentSubmission",
subject: "Start Selling",
subject: "Contact Dana",
})
)
})
Expand Down

0 comments on commit dacdeeb

Please sign in to comment.