Bump local twake-mui lockfile to 1.1.8.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
extractVideoConferenceFromDescription,
|
||||
generateMeetingId,
|
||||
generateMeetingLink,
|
||||
removeVideoConferenceFromDescription,
|
||||
} from "../videoConferenceUtils";
|
||||
|
||||
// Mock window object for Node.js environment
|
||||
@@ -82,4 +83,39 @@ describe("videoConferenceUtils", () => {
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("removeVideoConferenceFromDescription", () => {
|
||||
it("should return empty string when description is only the Visio line", () => {
|
||||
const description = "Visio: https://meet.linagora.com/abc-defg-hij";
|
||||
const result = removeVideoConferenceFromDescription(description);
|
||||
expect(result).toBe("");
|
||||
});
|
||||
|
||||
it("should remove Visio line when at end of description", () => {
|
||||
const description =
|
||||
"This is a meeting description.\nVisio: https://meet.linagora.com/abc-defg-hij";
|
||||
const result = removeVideoConferenceFromDescription(description);
|
||||
expect(result).toBe("This is a meeting description.");
|
||||
});
|
||||
|
||||
it("should remove Visio line when in middle of description", () => {
|
||||
const description =
|
||||
"Line one\nVisio: https://meet.linagora.com/abc-defg-hij\nLine two";
|
||||
const result = removeVideoConferenceFromDescription(description);
|
||||
expect(result).toBe("Line one\nLine two");
|
||||
});
|
||||
|
||||
it("should leave description unchanged when no Visio line present", () => {
|
||||
const description = "Just a regular meeting description.";
|
||||
const result = removeVideoConferenceFromDescription(description);
|
||||
expect(result).toBe(description);
|
||||
});
|
||||
|
||||
it("should remove Visio line when at start of description", () => {
|
||||
const description =
|
||||
"Visio: https://meet.linagora.com/abc-defg-hij\nRest of the text";
|
||||
const result = removeVideoConferenceFromDescription(description);
|
||||
expect(result).toBe("Rest of the text");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -59,3 +59,19 @@ export function extractVideoConferenceFromDescription(
|
||||
const match = description.match(/Visio:\s*(https?:\/\/[^\s]+)/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
const VISIO_LINE_REGEX = /^Visio:\s*https?:\/\/\S+$/;
|
||||
|
||||
/**
|
||||
* Remove the Visio video conference line from description.
|
||||
* Finds and removes the line matching "Visio: <url>" regardless of position (start, middle, end).
|
||||
* @param {string} description - Event description
|
||||
* @returns {string} Description with the Visio line removed
|
||||
*/
|
||||
export function removeVideoConferenceFromDescription(
|
||||
description: string
|
||||
): string {
|
||||
const lines = description.split("\n");
|
||||
const filtered = lines.filter((line) => !VISIO_LINE_REGEX.test(line.trim()));
|
||||
return filtered.join("\n").trimEnd();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user