File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,13 +43,9 @@ const mockComment = {
4343describe ( "CommentResolvedText" , ( ) => {
4444 it ( "should render the sanitized comment with display names" , ( ) => {
4545 // Mock the return value of getMessageWithDisplayName
46+ const sanitizedHtml = "Hello <b>@John Doe</b>" ;
4647 ( getMessageWithDisplayName as unknown as Mock ) . mockReturnValue (
47- "Hello <b>@John Doe</b>"
48- ) ;
49-
50- // Mock the return value of sanitizeData
51- ( sanitizeData as unknown as Mock ) . mockReturnValue (
52- "Hello <b>@John Doe</b>"
48+ sanitizedHtml
5349 ) ;
5450
5551 // Render the component with mock props
@@ -67,14 +63,11 @@ describe("CommentResolvedText", () => {
6763 "html"
6864 ) ;
6965
70- // Expect sanitizeData to have been called with the correct text
71- expect ( sanitizeData ) . toHaveBeenCalledWith ( "Hello <b>@John Doe</b>" ) ;
72-
7366 // Verify the component renders the sanitized HTML correctly
7467 const messageElement = screen . getByTestId (
7568 "collab-thread-comment--message"
7669 ) ;
7770 expect ( messageElement ) . toBeInTheDocument ( ) ;
78- expect ( messageElement . innerHTML ) . toBe ( "Hello <b>@John Doe</b>" ) ;
71+ expect ( messageElement . innerHTML ) . toBe ( sanitizedHtml ) ;
7972 } ) ;
8073} ) ;
You can’t perform that action at this time.
0 commit comments