Skip to content

Commit

Permalink
action_sheet test [nfc]: Have showFromAppBar take messages, not `me…
Browse files Browse the repository at this point in the history
…ssage`

When we add the resolve/unresolve button, coming up, we'll use this
to test the edge case where the button isn't shown in the
message-list app bar if the message list is empty. (For that case
we'll just pass an empty Iterable for this.)
  • Loading branch information
chrisbobbe committed Jan 24, 2025
1 parent d2b1c58 commit 7313b0a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/widgets/action_sheet_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ void main() {
Future<void> showFromAppBar(WidgetTester tester, {
ZulipStream? channel,
String topic = someTopic,
StreamMessage? message,
Iterable<StreamMessage>? messages,
}) async {
final effectiveChannel = channel ?? someChannel;
final effectiveMessage = message ?? someMessage;
assert(effectiveMessage.topic.apiName == topic);
final effectiveMessages = messages ?? [someMessage];
assert(effectiveMessages.every((m) => m.topic.apiName == topic));

connection.prepare(json: eg.newestGetMessagesResult(
foundOldest: true, messages: [effectiveMessage]).toJson());
foundOldest: true, messages: effectiveMessages.toList()).toJson());
await tester.pumpWidget(TestZulipApp(accountId: eg.selfAccount.id,
child: MessageListPage(
initNarrow: eg.topicNarrow(effectiveChannel.streamId, topic))));
Expand Down Expand Up @@ -288,7 +288,8 @@ void main() {

final message = eg.streamMessage(
stream: someChannel, topic: topic, sender: eg.otherUser);
await showFromAppBar(tester, channel: someChannel, topic: topic, message: message);
await showFromAppBar(tester,
channel: someChannel, topic: topic, messages: [message]);
}

void checkButtons(List<Finder> expectedButtonFinders) {
Expand Down

0 comments on commit 7313b0a

Please sign in to comment.