Skip to content

Commit

Permalink
MAT-7372 CQL Library: Unable to draft a library
Browse files Browse the repository at this point in the history
  • Loading branch information
adongare committed Jun 26, 2024
1 parent 9b7d388 commit 4f92a7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/cqlLibraryList/CqlLibraryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
Button,
MadieDeleteDialog,
} from "@madie/madie-design-system/dist/react";
import _ from "lodash";

const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
props,
Expand Down
6 changes: 6 additions & 0 deletions src/components/createDraftDialog/CreateDraftDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const cqlLibrary: CqlLibrary = {
cql: null,
};

jest.mock("@madie/madie-editor", () => ({
synchingEditorCqlContent: jest.fn().mockResolvedValue({
cql: "library testing1 version '0.0.000'",
}),
}));

describe("Create Draft Dialog component", () => {
beforeEach(() => {
clearAllMocks();
Expand Down
8 changes: 6 additions & 2 deletions src/components/createDraftDialog/CreateDraftDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CreatDraftDialog = ({

const submitForm = async (cqlLibraryName: string) => {
const cqlModelInfo: string[] = _.split(cqlLibrary?.model, " v", 2);
const inSyncCql = await synchingEditorCqlContent(
const editorContents = await synchingEditorCqlContent(
"",
cqlLibrary?.cql,
cqlLibraryName,
Expand All @@ -51,7 +51,11 @@ const CreatDraftDialog = ({
cqlModelInfo[1],
"draftDialog"
);
return onSubmit({ ...cqlLibrary, cqlLibraryName, cql: inSyncCql });
return onSubmit({
...cqlLibrary,
cqlLibraryName,
cql: editorContents?.cql,
});
};

return (
Expand Down

0 comments on commit 4f92a7e

Please sign in to comment.