Skip to content

Commit

Permalink
Merge pull request #150 from MeasureAuthoringTool/MAT-7431
Browse files Browse the repository at this point in the history
MAT-7431 Incorrect messaging when user attempts to save an empty CQL …
  • Loading branch information
adongare authored Jul 8, 2024
2 parents 97aa7f1 + 51dec4f commit 73def11
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
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 @@ -242,28 +242,30 @@ const EditCqlLibrary = () => {
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

0 comments on commit 73def11

Please sign in to comment.