Skip to content

Commit

Permalink
msglist test: Make new DmRecpientHeader group; move two tests into it
Browse files Browse the repository at this point in the history
A counterpart to the StreamMessageRecipientHeader group.
  • Loading branch information
chrisbobbe committed May 20, 2024
1 parent afaf8f3 commit 3b5f5ca
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions test/widgets/message_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,35 +368,37 @@ void main() {
});
});

testWidgets('show names on DMs', (tester) async {
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
await setupMessageListPage(tester, messages: [
eg.dmMessage(from: eg.selfUser, to: []),
eg.dmMessage(from: eg.otherUser, to: [eg.selfUser]),
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser, eg.otherUser]),
]);
store.addUser(eg.otherUser);
store.addUser(eg.thirdUser);
await tester.pump();
tester.widget(find.text(zulipLocalizations.messageListGroupYouWithYourself));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
eg.otherUser.fullName)));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
"${eg.otherUser.fullName}, ${eg.thirdUser.fullName}")));
});
group('DmRecipientHeader', () {
testWidgets('show names', (tester) async {
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
await setupMessageListPage(tester, messages: [
eg.dmMessage(from: eg.selfUser, to: []),
eg.dmMessage(from: eg.otherUser, to: [eg.selfUser]),
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser, eg.otherUser]),
]);
store.addUser(eg.otherUser);
store.addUser(eg.thirdUser);
await tester.pump();
tester.widget(find.text(zulipLocalizations.messageListGroupYouWithYourself));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
eg.otherUser.fullName)));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
"${eg.otherUser.fullName}, ${eg.thirdUser.fullName}")));
});

testWidgets('show names on DMs: smoothly handle unknown users', (tester) async {
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
await setupMessageListPage(tester, messages: [
eg.dmMessage(from: eg.otherUser, to: [eg.selfUser]),
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser, eg.otherUser]),
]);
store.addUser(eg.thirdUser);
await tester.pump();
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
zulipLocalizations.unknownUserName)));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
"${zulipLocalizations.unknownUserName}, ${eg.thirdUser.fullName}")));
testWidgets('show names: smoothly handle unknown users', (tester) async {
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
await setupMessageListPage(tester, messages: [
eg.dmMessage(from: eg.otherUser, to: [eg.selfUser]),
eg.dmMessage(from: eg.thirdUser, to: [eg.selfUser, eg.otherUser]),
]);
store.addUser(eg.thirdUser);
await tester.pump();
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
zulipLocalizations.unknownUserName)));
tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers(
"${zulipLocalizations.unknownUserName}, ${eg.thirdUser.fullName}")));
});
});

testWidgets('show dates', (tester) async {
Expand Down

0 comments on commit 3b5f5ca

Please sign in to comment.