@@ -20,10 +20,12 @@ void main() {
2020 required bool expectLegacy,
2121 required int messageId,
2222 bool ? applyMarkdown,
23+ bool ? allowEmptyTopicName,
2324 }) async {
2425 final result = await getMessageCompat (connection,
2526 messageId: messageId,
2627 applyMarkdown: applyMarkdown,
28+ allowEmptyTopicName: allowEmptyTopicName,
2729 );
2830 if (expectLegacy) {
2931 check (connection.lastRequest).isA< http.Request > ()
@@ -43,6 +45,8 @@ void main() {
4345 ..url.path.equals ('/api/v1/messages/$messageId ' )
4446 ..url.queryParameters.deepEquals ({
4547 if (applyMarkdown != null ) 'apply_markdown' : applyMarkdown.toString (),
48+ if (allowEmptyTopicName != null )
49+ 'allow_empty_topic_name' : allowEmptyTopicName.toString (),
4650 });
4751 }
4852 return result;
@@ -57,6 +61,7 @@ void main() {
5761 expectLegacy: false ,
5862 messageId: message.id,
5963 applyMarkdown: true ,
64+ allowEmptyTopicName: true ,
6065 );
6166 check (result).isNotNull ().jsonEquals (message);
6267 });
@@ -71,6 +76,7 @@ void main() {
7176 expectLegacy: false ,
7277 messageId: message.id,
7378 applyMarkdown: true ,
79+ allowEmptyTopicName: true ,
7480 );
7581 check (result).isNull ();
7682 });
@@ -92,6 +98,7 @@ void main() {
9298 expectLegacy: true ,
9399 messageId: message.id,
94100 applyMarkdown: true ,
101+ allowEmptyTopicName: null ,
95102 );
96103 check (result).isNotNull ().jsonEquals (message);
97104 });
@@ -113,6 +120,7 @@ void main() {
113120 expectLegacy: true ,
114121 messageId: message.id,
115122 applyMarkdown: true ,
123+ allowEmptyTopicName: null ,
116124 );
117125 check (result).isNull ();
118126 });
@@ -124,11 +132,13 @@ void main() {
124132 FakeApiConnection connection, {
125133 required int messageId,
126134 bool ? applyMarkdown,
135+ bool ? allowEmptyTopicName,
127136 required Map <String , String > expected,
128137 }) async {
129138 final result = await getMessage (connection,
130139 messageId: messageId,
131140 applyMarkdown: applyMarkdown,
141+ allowEmptyTopicName: allowEmptyTopicName,
132142 );
133143 check (connection.lastRequest).isA< http.Request > ()
134144 ..method.equals ('GET' )
@@ -159,6 +169,16 @@ void main() {
159169 });
160170 });
161171
172+ test ('allow empty topic name' , () {
173+ return FakeApiConnection .with_ ((connection) async {
174+ connection.prepare (json: fakeResult.toJson ());
175+ await checkGetMessage (connection,
176+ messageId: 1 ,
177+ allowEmptyTopicName: true ,
178+ expected: {'allow_empty_topic_name' : 'true' });
179+ });
180+ });
181+
162182 test ('Throws assertion error when FL <120' , () {
163183 return FakeApiConnection .with_ (zulipFeatureLevel: 119 , (connection) async {
164184 connection.prepare (json: fakeResult.toJson ());
@@ -255,12 +275,14 @@ void main() {
255275 required int numAfter,
256276 bool ? clientGravatar,
257277 bool ? applyMarkdown,
278+ bool ? allowEmptyTopicName,
258279 required Map <String , String > expected,
259280 }) async {
260281 final result = await getMessages (connection,
261282 narrow: narrow, anchor: anchor, includeAnchor: includeAnchor,
262283 numBefore: numBefore, numAfter: numAfter,
263284 clientGravatar: clientGravatar, applyMarkdown: applyMarkdown,
285+ allowEmptyTopicName: allowEmptyTopicName,
264286 );
265287 check (connection.lastRequest).isA< http.Request > ()
266288 ..method.equals ('GET' )
@@ -279,11 +301,13 @@ void main() {
279301 await checkGetMessages (connection,
280302 narrow: const CombinedFeedNarrow ().apiEncode (),
281303 anchor: AnchorCode .newest, numBefore: 10 , numAfter: 20 ,
304+ allowEmptyTopicName: true ,
282305 expected: {
283306 'narrow' : jsonEncode ([]),
284307 'anchor' : 'newest' ,
285308 'num_before' : '10' ,
286309 'num_after' : '20' ,
310+ 'allow_empty_topic_name' : 'true' ,
287311 });
288312 });
289313 });
0 commit comments