Skip to content

Commit

Permalink
Merge pull request #349 from MeasureAuthoringTool/MAT-7501_qiCore6.0.0
Browse files Browse the repository at this point in the history
MAT-7501 support QICore v6.0.0
  • Loading branch information
sb-cecilialiu authored Aug 14, 2024
2 parents 51fa627 + ae3a0e0 commit 878af15
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
18 changes: 10 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@madie/madie-auth": "^0.0.2",
"@madie/madie-design-system": "^1.2.23",
"@madie/madie-editor": "^0.0.2",
"@madie/madie-models": "^1.3.18",
"@madie/madie-models": "^1.4.14",
"@madie/madie-root": "^0.0.2",
"@mui/icons-material": "^5.8.2",
"@mui/lab": "^5.0.0-alpha.82",
Expand All @@ -86,7 +86,7 @@
"@okta/okta-auth-js": "^7.5.0",
"@okta/okta-react": "^6.9.0",
"@tailwindcss/forms": "^0.5.3",
"axios": "^1.6.8",
"axios": "^1.7.4",
"classnames": "^2.3.1",
"formik": "^2.2.9",
"qs": "^6.10.3",
Expand Down
34 changes: 34 additions & 0 deletions src/components/NewMeasure/CreateNewMeasureDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,38 @@ describe("Measures Create Dialog", () => {
const submitButton = await getByTestId("continue-button");
await waitFor(() => expect(submitButton).toBeDisabled());
}, 10000);

test("Model dropdown does not show QI-Core v6.0.0", async () => {
(useFeatureFlags as jest.Mock).mockReturnValue({ qiCore6: false });
const { queryByTestId, getByTestId } = await render(
<CreateNewMeasureDialog open={true} onClose={undefined} />
);
const modelSelectDropDown = getByTestId("measure-model-select");
const modelSelectBtn = within(modelSelectDropDown).getByRole("button");
userEvent.click(modelSelectBtn);
expect(
getByTestId("measure-model-option-QI-Core v4.1.1")
).toBeInTheDocument();
expect(
queryByTestId("measure-model-option-QI-Core v6.0.0")
).not.toBeInTheDocument();
expect(getByTestId("measure-model-option-QDM v5.6")).toBeInTheDocument();
});

test("Model dropdown shows QI-Core v6.0.0 when feature flag is on", async () => {
(useFeatureFlags as jest.Mock).mockReturnValue({ qiCore6: true });
const { getByTestId } = await render(
<CreateNewMeasureDialog open={true} onClose={undefined} />
);
const modelSelectDropDown = getByTestId("measure-model-select");
const modelSelectBtn = within(modelSelectDropDown).getByRole("button");
userEvent.click(modelSelectBtn);
expect(
getByTestId("measure-model-option-QI-Core v4.1.1")
).toBeInTheDocument();
expect(
getByTestId("measure-model-option-QI-Core v6.0.0")
).toBeInTheDocument();
expect(getByTestId("measure-model-option-QDM v5.6")).toBeInTheDocument();
});
});
8 changes: 6 additions & 2 deletions src/components/NewMeasure/CreateNewMeasureDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
MadieAlert,
} from "@madie/madie-design-system/dist/react";
import { Box } from "@mui/system";

import {
wafIntercept,
getServiceConfig,
ServiceConfig,
useOktaTokens,
useFeatureFlags,
} from "@madie/madie-util";
import axios from "../../../api/axios-instance";
import {
Expand Down Expand Up @@ -67,7 +67,11 @@ const CreateNewMeasureDialog = ({ open, onClose }) => {
},
});

const modelOptions = Object.keys(Model);
let modelOptions = Object.keys(Model);
const featureFlags = useFeatureFlags();
if (!featureFlags?.qiCore6) {
modelOptions = modelOptions.filter((option) => option !== "QICORE_6_0_0");
}

async function createMeasure(measure: Measure) {
const config: ServiceConfig = await getServiceConfig();
Expand Down
2 changes: 2 additions & 0 deletions src/types/madie-madie-util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ declare module "@madie/madie-util" {
populationCriteriaTabs: boolean;
importTestCases: boolean;
qdm: boolean;
qiCore6: boolean;
};
}

Expand All @@ -34,6 +35,7 @@ declare module "@madie/madie-util" {

interface FeatureFlags {
importTestCases: boolean;
qiCore6: boolean;
}

export const cqlLibraryStore: {
Expand Down

0 comments on commit 878af15

Please sign in to comment.