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

MAT-7431 Incorrect messaging when user attempts to save an empty CQL … #150

Merged
merged 1 commit into from
Jul 8, 2024
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
4 changes: 3 additions & 1 deletion src/components/editCqlLibrary/EditCqlLibrary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,9 @@ describe("Edit Cql Library Component", () => {
(synchingEditorCqlContent as jest.Mock)
.mockClear()
.mockImplementation(() => {
return "library UpdateName version '1.0.000'";
return {
cql: "library UpdateName version '1.0.000'",
};
});

isUsingEmpty.mockClear().mockImplementation(() => true);
Expand Down
46 changes: 24 additions & 22 deletions src/components/editCqlLibrary/EditCqlLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
setErrorMessage("An error occurred while fetching the CQL Library!");
});
}
}, [id, resetForm, loadedCqlLibrary, cqlLibraryServiceApi]);

Check warning on line 168 in src/components/editCqlLibrary/EditCqlLibrary.tsx

View workflow job for this annotation

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

React Hook useEffect has a missing dependency: 'handleAnnotations'. Either include it or remove the dependency array

// fetch organizations DB using measure service and sorts alphabetically
useEffect(() => {
Expand All @@ -181,7 +181,7 @@
const message = `Error fetching organizations`;
handleToast("danger", message, true);
});
}, []);

Check warning on line 184 in src/components/editCqlLibrary/EditCqlLibrary.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 updateCqlLibrary(cqlLibrary: CqlLibrary) {
setActiveSpinner(true);
Expand Down Expand Up @@ -242,28 +242,30 @@
resetForm();
let primaryMessage = "CQL updated successfully";
const secondaryMessages = [];
if (isUsingEmpty(updatedContent.cql)) {
secondaryMessages.push(
"Missing a using statement. Please add in a valid model and version."
);
}
if (updatedContent.isLibraryStatementChanged) {
secondaryMessages.push(
"Library statement was incorrect. MADiE has overwritten it."
);
}
if (updatedContent.isUsingStatementChanged) {
secondaryMessages.push(
"Using statement was incorrect. MADiE has overwritten it."
);
}
if (updatedContent.isValueSetChanged) {
secondaryMessages.push(
"MADiE does not currently support use of value set version directly in library at this time. Your value set versions have been removed. Please use the relevant manifest for value set expansion for testing."
);
}
if (secondaryMessages.length > 0) {
primaryMessage += " but the following issues were found";
if (updatedContent.cql?.trim()) {
if (isUsingEmpty(updatedContent.cql)) {
secondaryMessages.push(
"Missing a using statement. Please add in a valid model and version."
);
}
if (updatedContent.isLibraryStatementChanged) {
secondaryMessages.push(
"Library statement was incorrect. MADiE has overwritten it."
);
}
if (updatedContent.isUsingStatementChanged) {
secondaryMessages.push(
"Using statement was incorrect. MADiE has overwritten it."
);
}
if (updatedContent.isValueSetChanged) {
secondaryMessages.push(
"MADiE does not currently support use of value set version directly in library at this time. Your value set versions have been removed. Please use the relevant manifest for value set expansion for testing."
);
}
if (secondaryMessages.length > 0) {
primaryMessage += " but the following issues were found";
}
}
setSuccess({
status: "success",
Expand Down
Loading