Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-6930: Remove Feature Flags #589

Merged
merged 13 commits into from
Mar 25, 2024
Merged
19 changes: 0 additions & 19 deletions src/components/editTestCase/qdm/EditTestCase.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ jest.mock("@madie/madie-util", () => ({
useFeatureFlags: jest.fn(() => {
return {
applyDefaults: mockApplyDefaults,
disableRunTestCaseWithObservStrat: true,
qdmHideJson: false,
qdmHighlightingTabs: true,
};
}),
measureStore: {
Expand Down Expand Up @@ -526,7 +524,6 @@ describe("EditTestCase QDM Component", () => {
(useFeatureFlags as jest.Mock).mockClear().mockImplementation(() => {
return {
applyDefaults: mockApplyDefaults,
disableRunTestCaseWithObservStrat: false,
};
});
});
Expand Down Expand Up @@ -555,22 +552,6 @@ describe("EditTestCase QDM Component", () => {
await waitFor(() => expect(actualResult).toBeChecked());
});

it("should disable run qdm test case", async () => {
(useFeatureFlags as jest.Mock).mockClear().mockImplementationOnce(() => {
return {
applyDefaults: mockApplyDefaults,
disableRunTestCaseWithObservStrat: true,
};
});
await waitFor(() => renderEditTestCaseComponent());
const runTestCaseButton = await getByRole("button", {
name: "Run Test",
});
expect(runTestCaseButton).toBeInTheDocument();

expect(runTestCaseButton).toBeDisabled();
});

it("should see that the JSON changed", async () => {
await waitFor(() => renderEditTestCaseComponent());
const runTestCaseButton = await getByRole("button", {
Expand Down
16 changes: 0 additions & 16 deletions src/components/editTestCase/qdm/EditTestCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,6 @@ const EditTestCase = () => {
const featureFlags = useFeatureFlags();
const [hasObservationOrStratification, setHasObservationOrStratification] =
useState(false);
useEffect(() => {
if (featureFlags?.disableRunTestCaseWithObservStrat) {
const groups: Group[] = measure?.groups;
groups?.forEach((group) => {
const measureObservations: MeasureObservation[] =
group?.measureObservations;
const measureStratifications: Stratification[] = group?.stratifications;
if (
(measureObservations && measureObservations.length > 0) ||
(measureStratifications && measureStratifications.length > 0)
) {
setHasObservationOrStratification(true);
}
});
}
}, [measure, measure?.groups]);
const formik = useFormik({
initialValues: {
title: currentTestCase?.title || "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RightPanel = ({
</IconButton>
</div>
<div className="panel-content">
{featureFlags.qdmHighlightingTabs && activeTab === "highlighting" && (
{activeTab === "highlighting" && (
<CalculationResults
groupCoverageResult={groupCoverageResult}
testCaseGroups={testCaseGroups}
Expand Down
5 changes: 2 additions & 3 deletions src/components/editTestCase/qiCore/EditTestCase.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ jest.mock("@madie/madie-util", () => {
return {
applyDefaults: mockApplyDefaults,
qiCoreElementsTab: true,
highlightingTabs: false,
};
},
measureStore: {
Expand Down Expand Up @@ -2370,7 +2369,7 @@ describe("EditTestCase component", () => {
});
userEvent.click(screen.getByTestId("highlighting-tab"));
expect(
await screen.findByText("Population Criteria 1")
await screen.findByText("Population Criteria")
).toBeInTheDocument();

userEvent.click(screen.getByTestId("expectoractual-tab"));
Expand Down Expand Up @@ -2487,7 +2486,7 @@ describe("EditTestCase component", () => {
});
userEvent.click(screen.getByTestId("highlighting-tab"));
expect(
await screen.findByText("Population Criteria 1")
await screen.findByText("Population Criteria")
).toBeInTheDocument();

userEvent.click(screen.getByTestId("expectoractual-tab"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,12 @@ describe("CalculationResults with tabbed highlighting layout off", () => {
},
];

beforeEach(() => {
useFeatureFlags.mockReturnValue({ highlightingTabs: false });
});

test("display info message when test case has not been ran yet", () => {
renderCoverageComponent();
expect(
screen.getByText("To see the logic highlights, click 'Run Test'")
).toBeInTheDocument();
});

test("render calculation results", () => {
renderCoverageComponent(calculationResults);
expect(screen.getByText("Population Criteria 1")).toBeInTheDocument();
expect(screen.getByText("Population Criteria 2")).toBeInTheDocument();
});

test("render calculation errors if any", () => {
const errorMessage = "Something is not right";
renderCoverageComponent([], { status: "error", message: errorMessage });
expect(screen.getByText(`${errorMessage}`)).toBeInTheDocument();
expect(screen.getByTestId("calculation-results").innerHTML).toEqual("");
});
});

describe("CalculationResults with new tabbed highlighting layout on", () => {
Expand Down Expand Up @@ -283,10 +266,6 @@ describe("CalculationResults with new tabbed highlighting layout on", () => {
},
];

beforeEach(() => {
useFeatureFlags.mockReturnValue({ highlightingTabs: true });
});

const getByRole = (name) => screen.findByRole("tab", { name: name });
const getCriteriaOptions = () => {
const criteriaSelector = screen.getByTestId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const CalculationResults = ({
},
{}
),
populationRelevance: populationRelevance.reduce(
populationRelevance: populationRelevance?.reduce(
(
populationRelevanceOutput,
{ criteriaExpression, populationId, populationType, result }
Expand Down Expand Up @@ -140,18 +140,13 @@ const CalculationResults = ({
}}
/>
)}
{featureFlags.highlightingTabs && !isEmpty(groupPopulations) && (
{!isEmpty(groupPopulations) && (
<QiCoreGroupCoverage
groupPopulations={groupPopulations}
mappedCalculationResults={mapCalculationResults(calculationResults)}
cqlDefinitionCallstack={cqlDefinitionCallstack}
/>
)}
{!featureFlags.highlightingTabs && coverageHtmls && (
<div tw="text-sm" data-testid="calculation-results">
{coverageHtmls.map((coverageHtml) => parse(coverageHtml))}
</div>
)}
</div>
);
};
Expand Down
2 changes: 0 additions & 2 deletions src/components/routes/qdm/TestCaseRoutes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ jest.mock("@madie/madie-util", () => ({
},
useFeatureFlags: jest.fn().mockImplementation(() => ({
applyDefaults: false,
importTestCases: false,
qdmTestCases: true,
})),
useOktaTokens: () => ({
getAccessToken: () => "test.jwt",
Expand Down
68 changes: 30 additions & 38 deletions src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,19 @@ export default function CreateCodeCoverageNavTabs(props: NavTabProps) {
const [optionsOpen, setOptionsOpen] = useState<boolean>(false);
const [anchorEl, setAnchorEl] = useState(null);
useEffect(() => {
if (featureFlags?.disableRunTestCaseWithObservStrat) {
const groups: Group[] = measure?.groups;
groups?.forEach((group) => {
const measureObservations: MeasureObservation[] =
group?.measureObservations;
const measureStratifications: Stratification[] = group?.stratifications;
if (
(measureObservations && measureObservations.length > 0) ||
(measureStratifications && measureStratifications.length > 0)
) {
setShouldDisableRunTestsButton(true);
}
});
} else {
setShouldDisableRunTestsButton(false);
}
}, [
measure,
measure?.groups,
featureFlags?.disableRunTestCaseWithObservStrat,
]);
const groups: Group[] = measure?.groups;
groups?.forEach((group) => {
const measureObservations: MeasureObservation[] =
group?.measureObservations;
const measureStratifications: Stratification[] = group?.stratifications;
if (
(measureObservations && measureObservations.length > 0) ||
(measureStratifications && measureStratifications.length > 0)
) {
setShouldDisableRunTestsButton(true);
}
});
}, [measure, measure?.groups]);

const executionResultsDisplayTemplate = (label) => {
const codeCoverage = executeAllTestCases ? coveragePercentage : "-";
Expand Down Expand Up @@ -221,23 +213,23 @@ export default function CreateCodeCoverageNavTabs(props: NavTabProps) {
/>
Delete All
</Button>
{featureFlags?.importTestCases && (
<Button
onClick={() => {
if (onImportTestCases) {
onImportTestCases();
}
}}
disabled={!canEdit}
data-testid="show-import-test-cases-button"
>
<FileUploadIcon
style={{ margin: "0 5px 0 -2px" }}
fontSize="small"
/>
Import Test Cases
</Button>
)}

<Button
onClick={() => {
if (onImportTestCases) {
onImportTestCases();
}
}}
disabled={!canEdit}
data-testid="show-import-test-cases-button"
>
<FileUploadIcon
style={{ margin: "0 5px 0 -2px" }}
fontSize="small"
/>
Import Test Cases
</Button>

<Button
disabled={!canEdit}
onClick={createNewTestCase}
Expand Down
2 changes: 0 additions & 2 deletions src/components/testCaseLanding/qdm/TestCaseLanding.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ jest.mock("@madie/madie-util", () => ({
}),
useFeatureFlags: jest.fn().mockImplementation(() => ({
applyDefaults: false,
importTestCases: false,
qdmTestCases: true,
})),
}));

Expand Down
14 changes: 5 additions & 9 deletions src/components/testCaseLanding/qdm/TestCaseLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ const TestCaseLandingQdm = (props: TestCaseListProps) => {
return (
<div>
<section>
{featureFlags.qdmTestCases ? (
<TestCaseList
errors={props.errors}
setErrors={props.setErrors}
setWarnings={props.setWarnings}
/>
) : (
<div data-testid="coming-soon">"QDM Test Cases are Coming Soon!"</div>
)}
<TestCaseList
errors={props.errors}
setErrors={props.setErrors}
setWarnings={props.setWarnings}
/>
</section>
</div>
);
Expand Down
Loading
Loading