@@ -416,3 +416,84 @@ def test_cleanup_previous_unfeedback_qa_same_message(
416416
417417 # assertions
418418 mock_delete_state_information .assert_not_called ()
419+
420+
421+ def test_create_response_body_creates_body_with_markdown_formatting (
422+ mock_get_parameter : Mock ,
423+ mock_env : Mock ,
424+ ):
425+ """Test regex text processing functionality within process_async_slack_event"""
426+ # delete and import module to test
427+ if "app.slack.slack_events" in sys .modules :
428+ del sys .modules ["app.slack.slack_events" ]
429+ from app .slack .slack_events import _create_response_body
430+
431+ # perform operation
432+ response = _create_response_body (
433+ citations = [],
434+ feedback_data = {},
435+ response_text = "**Bold**, __italics__, *markdown italics*, and `code`." ,
436+ )
437+
438+ # assertions
439+ assert len (response ) > 0
440+ assert response [0 ]["type" ] == "section"
441+
442+ response_value = response [0 ]["text" ]["text" ]
443+
444+ assert "*Bold*, _italics_, _markdown italics_, and `code`." in response_value
445+
446+
447+ def test_create_response_body_creates_body_with_lists (
448+ mock_get_parameter : Mock ,
449+ mock_env : Mock ,
450+ ):
451+ """Test regex text processing functionality within process_async_slack_event"""
452+ # delete and import module to test
453+ if "app.slack.slack_events" in sys .modules :
454+ del sys .modules ["app.slack.slack_events" ]
455+ from app .slack .slack_events import _create_response_body
456+
457+ dirty_input = "Header text - Standard Dash -No Space Dash • Standard Bullet -NoSpace-NoSpace"
458+
459+ # perform operation
460+ response = _create_response_body (
461+ citations = [],
462+ feedback_data = {},
463+ response_text = dirty_input ,
464+ )
465+
466+ # assertions
467+ assert len (response ) > 0
468+ assert response [0 ]["type" ] == "section"
469+
470+ response_value = response [0 ]["text" ]["text" ]
471+
472+ expected_output = "Header text\n - Standard Dash\n - No Space Dash\n - Standard Bullet\n - NoSpace-NoSpace"
473+ assert expected_output in response_value
474+
475+
476+ def test_create_response_body_creates_body_without_encoding_errors (
477+ mock_get_parameter : Mock ,
478+ mock_env : Mock ,
479+ ):
480+ """Test regex text processing functionality within process_async_slack_event"""
481+ # delete and import module to test
482+ if "app.slack.slack_events" in sys .modules :
483+ del sys .modules ["app.slack.slack_events" ]
484+ from app .slack .slack_events import _create_response_body
485+
486+ # perform operation
487+ response = _create_response_body (
488+ citations = [],
489+ feedback_data = {},
490+ response_text = "» Tabbing Issue. ⢠Bullet point issue." ,
491+ )
492+
493+ # assertions
494+ assert len (response ) > 0
495+ assert response [0 ]["type" ] == "section"
496+
497+ response_value = response [0 ]["text" ]["text" ]
498+
499+ assert "Tabbing Issue.\n - Bullet point issue." in response_value
0 commit comments