diff --git a/__tests__/components/ab-testing/measuring-intentions.test.js b/__tests__/components/ab-testing/measuring-intentions.test.js index c2fcc6bc..f7f70c76 100644 --- a/__tests__/components/ab-testing/measuring-intentions.test.js +++ b/__tests__/components/ab-testing/measuring-intentions.test.js @@ -12,6 +12,7 @@ import { seRapprocheDeLaRealite, } from "../../../src/utils/ab-testing/measuring-intentions.utils" import { displayComponentsByTest } from "../../../src/components/ab-testing/intentions/MeasuringIntentions" +import * as ContactMamanBlues from "../../../src/components/results/ContactMamanBlues" describe("UI de MeasuringIntentions", () => { const findLabelEstLePlusAdapte = (value) => @@ -32,7 +33,7 @@ describe("UI de MeasuringIntentions", () => { }) ).toBeInTheDocument() expect( - screen.getByRole("button", { name: "être contacté(e)" }) + screen.getByRole("button", { name: ContactMamanBlues.buttonLabel }) ).toBeInTheDocument() } @@ -391,7 +392,9 @@ describe("UI de MeasuringIntentions", () => { expect(yesButton).not.toBeInTheDocument() expect(await screen.queryByText("Oui")).not.toBeInTheDocument() - expect(await screen.findByText("Prenez une des actions suivantes.")).toBeVisible() + expect( + await screen.findByText("Prenez une des actions suivantes.") + ).toBeVisible() // Nouveaux boutons expect( diff --git a/src/components/results/ContactMamanBlues.js b/src/components/results/ContactMamanBlues.js index 7340cb84..b1f21050 100644 --- a/src/components/results/ContactMamanBlues.js +++ b/src/components/results/ContactMamanBlues.js @@ -1,15 +1,14 @@ -import React, { useEffect } from "react" +import React from "react" import { Row } from "react-bootstrap" import { } from "@dataesr/react-dsfr" import { useRouter } from "next/router" import * as TrackerUtils from "../../utils/tracker.utils" -import * as ContactButtonLabelAbTesting from "../../utils/ab-testing/contact-button-label.utils" -import * as AbTestingUtils from "../../utils/ab-testing/ab-testing.utils" + +export const buttonLabel = "Je veux être accompagné.e" export function ContactMamanBlues({ scoreLevel }) { const router = useRouter() let colorsByLevel - const buttonLabel = ContactButtonLabelAbTesting.getContactButtonLabelByTest() switch (scoreLevel) { case 1: @@ -29,19 +28,14 @@ export function ContactMamanBlues({ scoreLevel }) { TrackerUtils.track( TrackerUtils.CATEG.contact, `Macaron d'Elise ${TrackerUtils.EVENT_CLICK}`, - "Être contacté(e)" + { buttonLabel } ) - AbTestingUtils.trackerForAbTesting(buttonLabel) router.push({ pathname: "/contact/to-be-contacted", }) } - useEffect(() => { - AbTestingUtils.trackerForAbTesting(`Macaron Elise - ${colorsByLevel}`) - }, []) - return (