Skip to content

Commit c961157

Browse files
committed
events test: Make test data more realistic
Both orig_subject and stream_id are documented to be present on message moves even if the message is not moved to a new topic/channel, respectively; propagate_mode is always present on message moves. See also API documentation: https://zulip.com/api/get-events#update_message Signed-off-by: Zixuan James Li <[email protected]>
1 parent b74297e commit c961157

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/api/model/events_test.dart

+8-3
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,28 @@ void main() {
9999
'message_ids': [message.id],
100100
'flags': <String>[],
101101
'edit_timestamp': 1718741351,
102-
'stream_id': eg.stream().streamId,
103102
};
104103

105104
test('stream_id -> origStreamId', () {
106105
check(Event.fromJson({ ...baseJson,
107106
'stream_id': 1,
108107
'new_stream_id': 2,
109-
}) as UpdateMessageEvent)
108+
'orig_subject': 'foo',
109+
'subject': null,
110+
'propagate_mode': 'change_all',
111+
})).isA<UpdateMessageEvent>()
110112
..origStreamId.equals(1)
111113
..newStreamId.equals(2);
112114
});
113115

114116
test('orig_subject -> origTopic, subject -> newTopic', () {
115117
check(Event.fromJson({ ...baseJson,
118+
'stream_id': 1,
119+
'new_stream_id': null,
116120
'orig_subject': 'foo',
117121
'subject': 'bar',
118-
}) as UpdateMessageEvent)
122+
'propagate_mode': 'change_all',
123+
})).isA<UpdateMessageEvent>()
119124
..origTopic.equals(const TopicName('foo'))
120125
..newTopic.equals(const TopicName('bar'));
121126
});

0 commit comments

Comments
 (0)