Skip to content

Commit

Permalink
MAT-7501 support QICore v6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilia Liu committed Aug 14, 2024
1 parent 045fba4 commit a6ba5e9
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: npm ci

- name: Audit dependencies for security vulnerabilities
run: npm audit --production
run: npm audit --omit=dev --audit-level=${{ vars.NPM_AUDIT_LEVEL }}

- name: Lint the source code
run: npm run-script lint
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion 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 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 a6ba5e9

Please sign in to comment.