Skip to content

Commit

Permalink
Merge pull request #492 from CBIIT/CRDCDH-1774
Browse files Browse the repository at this point in the history
CRDCDH-1774 Ignore casing when comparing name/abbr
  • Loading branch information
Alejandro-Vega authored Oct 11, 2024
2 parents 234ca24 + 376ae69 commit c7d44b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/utils/formUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ describe("formatFullStudyName cases", () => {
expect(result).toBe("Study Name");
});

it("should ignore casing when comparing the study name and abbreviation", () => {
const equalValuesWithDifferentCasing = utils.formatFullStudyName("study name", "STUDY NAME");
expect(equalValuesWithDifferentCasing).toBe("study name");

const equalValuesWithDifferentCasing2 = utils.formatFullStudyName("STUDY NAME", "study name");
expect(equalValuesWithDifferentCasing2).toBe("STUDY NAME");
});

it("should remove extra spaces from the study name", () => {
const studyName = " Study Name ";
const result = utils.formatFullStudyName(studyName, "");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/formUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const formatFullStudyName = (studyName: string, studyAbbreviation: string
if (typeof studyName !== "string") {
return "";
}
if (studyAbbreviation === studyName) {
if (studyAbbreviation?.toLowerCase() === studyName?.toLowerCase()) {
return studyName.trim();
}
if (studyAbbreviation && studyAbbreviation.length > 0) {
Expand Down

0 comments on commit c7d44b5

Please sign in to comment.