Skip to content

Commit 1cf7be6

Browse files
committed
Add regression test for calendar title transform
1 parent 3cab550 commit 1cf7be6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/unit/modules/default/calendar/calendar_utils_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,10 @@ describe("Calendar utils tests", () => {
151151
const expectedResult = `Luciella (${new Date().getFullYear() - 2000}.)`;
152152
expect(transformedTitle).toBe(expectedResult);
153153
});
154+
155+
it("should not fail when the yearmatchgroup regex does not match", () => {
156+
const transformedTitle = CalendarUtils.titleTransform("Test Birthday", [{ search: "^(.+) \\((\\d{4})\\)$", replace: "$1 ($2)", yearmatchgroup: 2 }]);
157+
expect(transformedTitle).toBe("Test Birthday");
158+
});
154159
});
155160
});

0 commit comments

Comments
 (0)