Skip to content

Commit

Permalink
Merge pull request #124 from MeasureAuthoringTool/feature/MAT-6157-fe…
Browse files Browse the repository at this point in the history
…ature-flags

ref MAT-6157: remove old feature flags
  • Loading branch information
nmorasb authored Dec 6, 2023
2 parents 196db60 + f14ac7a commit ea13113
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 47 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

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

32 changes: 1 addition & 31 deletions src/components/common/CreateNewLibraryDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jest.mock("@madie/madie-util", () => ({
getAllOrganizations: jest.fn().mockResolvedValue(organizations),
})),
useFeatureFlags: jest.fn().mockReturnValue({
qdm: false,
qdmExport: true,
}),
}));
const organizations = [
Expand Down Expand Up @@ -156,36 +156,6 @@ describe("Library Dialog", () => {
});
});

test("Does not show QDM as an option when flag is disabled", async () => {
(useFeatureFlags as jest.Mock).mockReturnValue({ qdm: false });
const onFormSubmit = jest.fn();
const onFormCancel = jest.fn();
render(
<ApiContextProvider value={serviceConfig}>
<div>
<button data-testId="open-button" onClick={onFormSubmit}>
I open the dialog
</button>
<CreateNewLibraryDialog open={true} onClose={onFormCancel} />
</div>
</ApiContextProvider>
);

const modelSelect = await screen.getByTestId("cql-library-model-select");
const modelSelectBtn = await within(modelSelect).getByRole("button");
userEvent.click(modelSelectBtn);
const options = await screen.findAllByRole("option");
expect(options.length).toEqual(1);
userEvent.click(options[0]);
expect(
(
(await within(modelSelect).getByRole("textbox", {
hidden: true,
})) as HTMLInputElement
).value
).toEqual("QI-Core v4.1.1");
});

test("Allows creation of a QDM library", async () => {
(useFeatureFlags as jest.Mock).mockReturnValue({ qdm: true });
const onFormSubmit = jest.fn();
Expand Down
7 changes: 2 additions & 5 deletions src/components/common/CreateNewLibraryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { Box } from "@mui/system";
import { FormHelperText, MenuItem } from "@mui/material";
import { useFormik } from "formik";
import { useFeatureFlags, useOrganizationApi } from "@madie/madie-util";
import { useOrganizationApi } from "@madie/madie-util";
import TextArea from "./TextArea";
import { v4 as uuidv4 } from "uuid";

Expand Down Expand Up @@ -42,11 +42,8 @@ const CreateNewLibraryDialog: React.FC<TestProps> = ({
const cqlLibraryServiceApi = useRef(useCqlLibraryServiceApi()).current;
const [organizations, setOrganizations] = useState<string[]>();
const organizationApi = useRef(useOrganizationApi()).current;
const featureFlags = useFeatureFlags();

const modelOptions = featureFlags?.qdm
? Object.keys(Model)
: [Object.keys(Model)[0]];
const modelOptions = Object.keys(Model);

// fetch organizations DB using measure service and sorts alphabetically
useEffect(() => {
Expand Down
6 changes: 1 addition & 5 deletions src/types/madie-madie-util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ declare module "@madie/madie-util" {
};

interface FeatureFlags {
export: boolean;
measureVersioning: boolean;
populationCriteriaTabs: boolean;
applyDefaults: boolean;
qdm: boolean;
qdmExport: boolean;
}

export function useFeatureFlags(): FeatureFlags;
Expand Down

0 comments on commit ea13113

Please sign in to comment.