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

ref MAT-6157: remove old feature flags #124

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { 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 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 All @@ -56,7 +53,7 @@
.map((element) => element.name);
setOrganizations(organizationsList);
});
}, []);

Check warning on line 56 in src/components/common/CreateNewLibraryDialog.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'organizationApi'. Either include it or remove the dependency array
async function createCqlLibrary(cqlLibrary: CqlLibrary) {
cqlLibrary.librarySetId = uuidv4();
cqlLibraryServiceApi
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
Loading