@@ -20,10 +20,12 @@ void main() {
20
20
required bool expectLegacy,
21
21
required int messageId,
22
22
bool ? applyMarkdown,
23
+ bool ? allowEmptyTopicName,
23
24
}) async {
24
25
final result = await getMessageCompat (connection,
25
26
messageId: messageId,
26
27
applyMarkdown: applyMarkdown,
28
+ allowEmptyTopicName: allowEmptyTopicName,
27
29
);
28
30
if (expectLegacy) {
29
31
check (connection.lastRequest).isA< http.Request > ()
@@ -43,6 +45,8 @@ void main() {
43
45
..url.path.equals ('/api/v1/messages/$messageId ' )
44
46
..url.queryParameters.deepEquals ({
45
47
if (applyMarkdown != null ) 'apply_markdown' : applyMarkdown.toString (),
48
+ if (allowEmptyTopicName != null )
49
+ 'allow_empty_topic_name' : allowEmptyTopicName.toString (),
46
50
});
47
51
}
48
52
return result;
@@ -57,6 +61,7 @@ void main() {
57
61
expectLegacy: false ,
58
62
messageId: message.id,
59
63
applyMarkdown: true ,
64
+ allowEmptyTopicName: true ,
60
65
);
61
66
check (result).isNotNull ().jsonEquals (message);
62
67
});
@@ -71,6 +76,7 @@ void main() {
71
76
expectLegacy: false ,
72
77
messageId: message.id,
73
78
applyMarkdown: true ,
79
+ allowEmptyTopicName: true ,
74
80
);
75
81
check (result).isNull ();
76
82
});
@@ -92,6 +98,7 @@ void main() {
92
98
expectLegacy: true ,
93
99
messageId: message.id,
94
100
applyMarkdown: true ,
101
+ allowEmptyTopicName: null ,
95
102
);
96
103
check (result).isNotNull ().jsonEquals (message);
97
104
});
@@ -113,6 +120,7 @@ void main() {
113
120
expectLegacy: true ,
114
121
messageId: message.id,
115
122
applyMarkdown: true ,
123
+ allowEmptyTopicName: null ,
116
124
);
117
125
check (result).isNull ();
118
126
});
@@ -124,11 +132,13 @@ void main() {
124
132
FakeApiConnection connection, {
125
133
required int messageId,
126
134
bool ? applyMarkdown,
135
+ bool ? allowEmptyTopicName,
127
136
required Map <String , String > expected,
128
137
}) async {
129
138
final result = await getMessage (connection,
130
139
messageId: messageId,
131
140
applyMarkdown: applyMarkdown,
141
+ allowEmptyTopicName: allowEmptyTopicName,
132
142
);
133
143
check (connection.lastRequest).isA< http.Request > ()
134
144
..method.equals ('GET' )
@@ -159,6 +169,16 @@ void main() {
159
169
});
160
170
});
161
171
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
+
162
182
test ('Throws assertion error when FL <120' , () {
163
183
return FakeApiConnection .with_ (zulipFeatureLevel: 119 , (connection) async {
164
184
connection.prepare (json: fakeResult.toJson ());
@@ -255,12 +275,14 @@ void main() {
255
275
required int numAfter,
256
276
bool ? clientGravatar,
257
277
bool ? applyMarkdown,
278
+ bool ? allowEmptyTopicName,
258
279
required Map <String , String > expected,
259
280
}) async {
260
281
final result = await getMessages (connection,
261
282
narrow: narrow, anchor: anchor, includeAnchor: includeAnchor,
262
283
numBefore: numBefore, numAfter: numAfter,
263
284
clientGravatar: clientGravatar, applyMarkdown: applyMarkdown,
285
+ allowEmptyTopicName: allowEmptyTopicName,
264
286
);
265
287
check (connection.lastRequest).isA< http.Request > ()
266
288
..method.equals ('GET' )
@@ -279,11 +301,13 @@ void main() {
279
301
await checkGetMessages (connection,
280
302
narrow: const CombinedFeedNarrow ().apiEncode (),
281
303
anchor: AnchorCode .newest, numBefore: 10 , numAfter: 20 ,
304
+ allowEmptyTopicName: true ,
282
305
expected: {
283
306
'narrow' : jsonEncode ([]),
284
307
'anchor' : 'newest' ,
285
308
'num_before' : '10' ,
286
309
'num_after' : '20' ,
310
+ 'allow_empty_topic_name' : 'true' ,
287
311
});
288
312
});
289
313
});
0 commit comments