From 1c219c1713d31c4684d7dc6d702cf9bc71f3898c Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Sat, 2 Nov 2024 10:07:44 -0400 Subject: [PATCH] Remove lowercasing in feature flag mock --- .../app/testQueue/TestCard/TestCard.test.tsx | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/frontend/src/app/testQueue/TestCard/TestCard.test.tsx b/frontend/src/app/testQueue/TestCard/TestCard.test.tsx index 6472df94d0..dc763dde7b 100644 --- a/frontend/src/app/testQueue/TestCard/TestCard.test.tsx +++ b/frontend/src/app/testQueue/TestCard/TestCard.test.tsx @@ -85,18 +85,11 @@ jest.mock("../../TelemetryService", () => ({ getAppInsights: jest.fn(), })); -const mockDiseaseEnabledFlag = ( - diseaseName: string, - skipLowercase: boolean = false -) => +const mockDiseaseEnabledFlag = (diseaseName: string) => jest .spyOn(flaggedMock, "useFeature") .mockImplementation((flagName: string) => { - // to handle casing of Hepatitis-C as hepatitisC - if (skipLowercase) { - return flagName === `${diseaseName}Enabled`; - } - return flagName === `${diseaseName.toLowerCase()}Enabled`; + return flagName === `${diseaseName}Enabled`; }); const mockNavigate = jest.fn(); @@ -1132,7 +1125,7 @@ describe("TestCard", () => { }); it("shows radio buttons for HIV when an HIV device is chosen", async function () { - mockDiseaseEnabledFlag("HIV"); + mockDiseaseEnabledFlag("hiv"); const mocks = [ generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.POSITIVE), @@ -1152,7 +1145,7 @@ describe("TestCard", () => { }); it("shows required HIV AOE questions when a positive HIV result is present", async function () { - mockDiseaseEnabledFlag("HIV"); + mockDiseaseEnabledFlag("hiv"); const mocks = [ generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.POSITIVE), @@ -1182,7 +1175,7 @@ describe("TestCard", () => { }); it("hides AOE questions when there is no positive HIV result", async function () { - mockDiseaseEnabledFlag("HIV"); + mockDiseaseEnabledFlag("hiv"); const mocks = [ generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.UNKNOWN), @@ -1209,7 +1202,7 @@ describe("TestCard", () => { }); it("shows radio buttons for Syphilis when a syphilis device is chosen", async function () { - mockDiseaseEnabledFlag("Syphilis"); + mockDiseaseEnabledFlag("syphilis"); const mocks = [ generateEditQueueMock( @@ -1229,7 +1222,7 @@ describe("TestCard", () => { }); it("shows required syphilis AOE questions when a positive syphilis result is present", async function () { - mockDiseaseEnabledFlag("Syphilis"); + mockDiseaseEnabledFlag("syphilis"); const mocks = [ generateEditQueueMock( @@ -1269,7 +1262,7 @@ describe("TestCard", () => { }); it("hides AOE questions when there is no positive syphilis result", async function () { - mockDiseaseEnabledFlag("Syphilis"); + mockDiseaseEnabledFlag("syphilis"); const mocks = [ generateEditQueueMock( @@ -1325,7 +1318,7 @@ describe("TestCard", () => { }); it("shows radio buttons for Hepatitis C when a hepatitis c device is chosen", async function () { - mockDiseaseEnabledFlag("hepatitisC", true); + mockDiseaseEnabledFlag("hepatitisC"); const mocks = [ generateEditQueueMock( @@ -1345,7 +1338,7 @@ describe("TestCard", () => { }); it("shows required Hepatitis-C AOE questions when a positive Hepatitis-C result is present", async function () { - mockDiseaseEnabledFlag("hepatitisC", true); + mockDiseaseEnabledFlag("hepatitisC"); const mocks = [ generateEditQueueMock( @@ -1397,7 +1390,7 @@ describe("TestCard", () => { }); it("hides AOE questions when there is no positive Hepatitis-C result", async function () { - mockDiseaseEnabledFlag("hepatitisC", true); + mockDiseaseEnabledFlag("hepatitisC"); const mocks = [ generateEditQueueMock( @@ -1443,7 +1436,7 @@ describe("TestCard", () => { }); it("checks that Hep C submission only works if AOE questions are valid", async function () { - mockDiseaseEnabledFlag("hepatitisC", true); + mockDiseaseEnabledFlag("hepatitisC"); const { user } = await renderQueueItem({ mocks: updateHepCAoeMocks }); const deviceDropdown = await getDeviceTypeDropdown(); @@ -1494,7 +1487,7 @@ describe("TestCard", () => { }); it("checks that submission only works if AOE questions are valid", async function () { - mockDiseaseEnabledFlag("Syphilis"); + mockDiseaseEnabledFlag("syphilis"); const { user } = await renderQueueItem({ mocks: updateSyphilisAoeMocks }); const deviceDropdown = await getDeviceTypeDropdown(); @@ -1556,7 +1549,7 @@ describe("TestCard", () => { }); it("checks that checking has symptom requires onset date and selection", async () => { - mockDiseaseEnabledFlag("Syphilis"); + mockDiseaseEnabledFlag("syphilis"); const mocks = [...updateSyphilisAoeMocks]; const { user } = await renderQueueItem({ mocks });