diff --git a/package-lock.json b/package-lock.json index 5296884..a4428ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,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", @@ -22,7 +22,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", @@ -3230,9 +3230,10 @@ } }, "node_modules/@madie/madie-models": { - "version": "1.3.18", - "resolved": "https://registry.npmjs.org/@madie/madie-models/-/madie-models-1.3.18.tgz", - "integrity": "sha512-J2s0ijlmN/wvXbBJw6LmxqvUsp02mLqBRLzsSt09RzLZdXIf9rGxsizUd4TZrrQzuFkifM0D2NRQwIno6vQkbQ==" + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@madie/madie-models/-/madie-models-1.4.14.tgz", + "integrity": "sha512-1hUqfCOyHnySn5cYopbzf0s+oQGiyx8/QxwbApGQpk5Ve+5PngQEwGDzTh0v39DPbWhqYoZ4Tc03s4u6XHZmdg==", + "license": "ISC" }, "node_modules/@madie/madie-root": { "version": "0.0.2", @@ -5013,9 +5014,10 @@ } }, "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", diff --git a/package.json b/package.json index c3b76ed..40d39a5 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/components/NewMeasure/CreateNewMeasureDialog.test.tsx b/src/components/NewMeasure/CreateNewMeasureDialog.test.tsx index 5194c57..423f846 100644 --- a/src/components/NewMeasure/CreateNewMeasureDialog.test.tsx +++ b/src/components/NewMeasure/CreateNewMeasureDialog.test.tsx @@ -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( + + ); + 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( + + ); + 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(); + }); }); diff --git a/src/components/NewMeasure/CreateNewMeasureDialog.tsx b/src/components/NewMeasure/CreateNewMeasureDialog.tsx index 8039f44..7cebbe8 100644 --- a/src/components/NewMeasure/CreateNewMeasureDialog.tsx +++ b/src/components/NewMeasure/CreateNewMeasureDialog.tsx @@ -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 { @@ -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(); diff --git a/src/types/madie-madie-util.d.ts b/src/types/madie-madie-util.d.ts index 457025c..7e32a42 100644 --- a/src/types/madie-madie-util.d.ts +++ b/src/types/madie-madie-util.d.ts @@ -24,6 +24,7 @@ declare module "@madie/madie-util" { populationCriteriaTabs: boolean; importTestCases: boolean; qdm: boolean; + qiCore6: boolean; }; } @@ -34,6 +35,7 @@ declare module "@madie/madie-util" { interface FeatureFlags { importTestCases: boolean; + qiCore6: boolean; } export const cqlLibraryStore: {