@@ -13,7 +13,12 @@ class TestAnnouncementFormatting(unittest.TestCase):
1313 def test_format_announcement_with_title_uses_single_newline (self ):
1414 announcement = _format_announcement ("my title" , "test" )
1515
16- self .assertEqual (announcement , "**my title**\n test" )
16+ self .assertEqual (announcement , "# my title\n test" )
17+
18+ def test_format_announcement_with_title_strips_leading_line_breaks_from_content (self ):
19+ announcement = _format_announcement ("my title" , "\n \n test" )
20+
21+ self .assertEqual (announcement , "# my title\n test" )
1722
1823 def test_format_announcement_without_title_has_no_leading_newline (self ):
1924 announcement = _format_announcement ("" , "test" )
@@ -84,7 +89,29 @@ async def test_on_submit_regular_submission_uses_single_newline(self):
8489 await modal .on_submit (mock_interaction )
8590
8691 mock_channel .send .assert_awaited_once_with (
87- content = "**my title**\n test" ,
92+ content = "# my title\n test" ,
93+ file = None
94+ )
95+
96+ async def test_on_submit_regular_submission_drops_leading_line_breaks_in_content (self ):
97+ mock_channel = MagicMock ()
98+ mock_channel .send = AsyncMock ()
99+
100+ mock_interaction = MagicMock (spec = Interaction )
101+ mock_interaction .response = MagicMock ()
102+ mock_interaction .response .is_done = MagicMock (return_value = False )
103+ mock_interaction .response .send_message = AsyncMock ()
104+ mock_interaction .followup = MagicMock ()
105+ mock_interaction .followup .send = AsyncMock ()
106+
107+ modal = Announcement (None , mock_channel , "regular" )
108+ modal .announcement_title = MagicMock (value = "my title" )
109+ modal .announcement = MagicMock (value = "\n \n test" )
110+
111+ await modal .on_submit (mock_interaction )
112+
113+ mock_channel .send .assert_awaited_once_with (
114+ content = "# my title\n test" ,
88115 file = None
89116 )
90117
0 commit comments