Skip to content

Commit c93f494

Browse files
author
MritunjayTiwari14
committed
inbox: Add test verify tapping a DM row
Added test that verify that after tapping a DM row, only that specific DM message list opens.
1 parent 530cbf4 commit c93f494

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/widgets/inbox_test.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,35 @@ void main() {
243243

244244
});
245245

246+
testWidgets('tapping a DM row opens the message list', (tester) async {
247+
final otherUser = eg.otherUser;
248+
final message = eg.dmMessage(from: otherUser, to: [eg.selfUser]);
249+
250+
await setupPage(tester,
251+
users: [eg.selfUser, otherUser],
252+
unreadMessages: [message]);
253+
254+
final connection = store.connection as FakeApiConnection;
255+
256+
connection.prepare(
257+
json: eg.newestGetMessagesResult(messages: [
258+
eg.dmMessage(from: otherUser, to: [eg.selfUser], flags: [MessageFlag.read]),
259+
], foundOldest: false).toJson(),
260+
);
261+
262+
connection.prepare(
263+
json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(),
264+
);
265+
266+
await tester.tap(find.text(otherUser.fullName));
267+
await tester.pumpAndSettle();
268+
269+
check(find.byType(HomePage)).findsNothing();
270+
check(find.byType(MessageListPage)).findsOne();
271+
272+
check(find.text(otherUser.fullName)).findsAny();
273+
});
274+
246275
});
247276

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

0 commit comments

Comments
 (0)