Skip to content

Commit f7a333e

Browse files
author
MritunjayTiwari14
committed
inbox: Add test to verify tapping a DM row
Add a test that verifies tapping a DM row opens only the message list for that specific DM.
1 parent eaf22a6 commit f7a333e

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

test/widgets/inbox_test.dart

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ void main() {
231231
check(text).style.isNotNull().color.isNotNull().isSameColorAs(expectedTextColor);
232232
});
233233

234-
// TODO test that tapping a conversation row opens the message list
235-
// for the conversation
236234
group('navigation', () {
237235
testWidgets('tapping a topic row opens the message list', (tester) async {
238236
final stream = eg.stream();
@@ -268,6 +266,35 @@ void main() {
268266

269267
});
270268

269+
testWidgets('tapping a DM row opens the message list', (tester) async {
270+
final otherUser = eg.otherUser;
271+
final message = eg.dmMessage(from: otherUser, to: [eg.selfUser]);
272+
273+
await setupPage(tester,
274+
users: [eg.selfUser, otherUser],
275+
unreadMessages: [message]);
276+
277+
final connection = store.connection as FakeApiConnection;
278+
279+
connection.prepare(
280+
json: eg.newestGetMessagesResult(messages: [
281+
eg.dmMessage(from: otherUser, to: [eg.selfUser], flags: [MessageFlag.read]),
282+
], foundOldest: false).toJson(),
283+
);
284+
285+
connection.prepare(
286+
json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(),
287+
);
288+
289+
await tester.tap(find.text(otherUser.fullName));
290+
await tester.pumpAndSettle();
291+
292+
check(find.byType(HomePage)).findsNothing();
293+
check(find.byType(MessageListPage)).findsOne();
294+
295+
check(find.text(otherUser.fullName)).findsAny();
296+
});
297+
271298
});
272299

273300
// Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.

0 commit comments

Comments
 (0)