Skip to content

Commit 46d4a53

Browse files
committed
api test [nfc]: Separate some checks on "special" narrows from other checks
And fix the name of the test.
1 parent d1c5f41 commit 46d4a53

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/api/route/messages_test.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,20 @@ void main() {
169169
});
170170
});
171171

172-
test('Narrow.toJson', () {
172+
test('ApiNarrow.toJson', () {
173173
return FakeApiConnection.with_((connection) async {
174174
void checkNarrow(ApiNarrow narrow, String expected) {
175175
narrow = resolveApiNarrowForServer(narrow, connection.zulipFeatureLevel!);
176176
check(jsonEncode(narrow)).equals(expected);
177177
}
178178

179+
checkNarrow(const MentionsNarrow().apiEncode(), jsonEncode([
180+
{'operator': 'is', 'operand': 'mentioned'},
181+
]));
182+
checkNarrow(const StarredMessagesNarrow().apiEncode(), jsonEncode([
183+
{'operator': 'is', 'operand': 'starred'},
184+
]));
185+
179186
checkNarrow(const CombinedFeedNarrow().apiEncode(), jsonEncode([]));
180187
checkNarrow(const ChannelNarrow(12).apiEncode(), jsonEncode([
181188
{'operator': 'stream', 'operand': 12},
@@ -184,12 +191,6 @@ void main() {
184191
{'operator': 'stream', 'operand': 12},
185192
{'operator': 'topic', 'operand': 'stuff'},
186193
]));
187-
checkNarrow(const MentionsNarrow().apiEncode(), jsonEncode([
188-
{'operator': 'is', 'operand': 'mentioned'},
189-
]));
190-
checkNarrow(const StarredMessagesNarrow().apiEncode(), jsonEncode([
191-
{'operator': 'is', 'operand': 'starred'},
192-
]));
193194

194195
checkNarrow([ApiNarrowDm([123, 234])], jsonEncode([
195196
{'operator': 'dm', 'operand': [123, 234]},

0 commit comments

Comments
 (0)