Skip to content

Commit aadec27

Browse files
gnpricechrisbobbe
authored andcommitted
test [nfc]: Event IDs start at zero
Unlike the various IDs for things in the database (users, messages, etc.), which are always positive, Zulip event IDs start at zero. Correspondingly, InitialSnapshot.lastEventId is -1 if there were no events queued up concurrently with the initial snapshot getting generated. So in the spirit of maximum boringness for test data, use those values by default.
1 parent 0e4e67e commit aadec27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/example_data.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,13 @@ UpdateMessageFlagsRemoveEvent updateMessageFlagsRemoveEvent(
604604
TypingEvent typingEvent(SendableNarrow narrow, TypingOp op, int senderId) {
605605
switch (narrow) {
606606
case TopicNarrow():
607-
return TypingEvent(id: 1, op: op, senderId: senderId,
607+
return TypingEvent(id: 0, op: op, senderId: senderId,
608608
messageType: MessageType.stream,
609609
streamId: narrow.streamId,
610610
topic: narrow.topic,
611611
recipientIds: null);
612612
case DmNarrow():
613-
return TypingEvent(id: 1, op: op, senderId: senderId,
613+
return TypingEvent(id: 0, op: op, senderId: senderId,
614614
messageType: MessageType.direct,
615615
recipientIds: narrow.allRecipientIds,
616616
streamId: null,
@@ -620,7 +620,7 @@ TypingEvent typingEvent(SendableNarrow narrow, TypingOp op, int senderId) {
620620

621621
ReactionEvent reactionEvent(Reaction reaction, ReactionOp op, int messageId) {
622622
return ReactionEvent(
623-
id: 1,
623+
id: 0,
624624
op: op,
625625
emojiName: reaction.emojiName,
626626
emojiCode: reaction.emojiCode,
@@ -665,7 +665,7 @@ InitialSnapshot initialSnapshot({
665665
}) {
666666
return InitialSnapshot(
667667
queueId: queueId ?? '1:2345',
668-
lastEventId: lastEventId ?? 1,
668+
lastEventId: lastEventId ?? -1,
669669
zulipFeatureLevel: zulipFeatureLevel ?? recentZulipFeatureLevel,
670670
zulipVersion: zulipVersion ?? recentZulipVersion,
671671
zulipMergeBase: zulipMergeBase ?? recentZulipVersion,

0 commit comments

Comments
 (0)