Skip to content

Commit

Permalink
test [nfc]: Factor out an eg.userTopicEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Jul 24, 2024
1 parent ee2523b commit f42af89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 11 additions & 0 deletions test/example_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,17 @@ const _unreadMsgs = unreadMsgs;
// Events.
//

UserTopicEvent userTopicEvent(
int streamId, String topic, UserTopicVisibilityPolicy visibilityPolicy) {
return UserTopicEvent(
id: 1,
streamId: streamId,
topicName: topic,
lastUpdated: 1234567890,
visibilityPolicy: visibilityPolicy,
);
}

DeleteMessageEvent deleteMessageEvent(List<StreamMessage> messages) {
assert(messages.isNotEmpty);
final streamId = messages.first.streamId;
Expand Down
9 changes: 2 additions & 7 deletions test/model/test_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:zulip/model/store.dart';
import 'package:zulip/widgets/store.dart';

import '../api/fake_api.dart';
import '../example_data.dart' as eg;

/// A [GlobalStore] containing data provided by callers,
/// and that causes no database queries or network requests.
Expand Down Expand Up @@ -146,13 +147,7 @@ extension PerAccountStoreTestExtension on PerAccountStore {
}

Future<void> addUserTopic(ZulipStream stream, String topic, UserTopicVisibilityPolicy visibilityPolicy) async {
await handleEvent(UserTopicEvent(
id: 1,
streamId: stream.streamId,
topicName: topic,
lastUpdated: 1234567890,
visibilityPolicy: visibilityPolicy,
));
await handleEvent(eg.userTopicEvent(stream.streamId, topic, visibilityPolicy));
}

Future<void> addMessage(Message message) async {
Expand Down

0 comments on commit f42af89

Please sign in to comment.