Skip to content

Commit 85cc089

Browse files
committed
events test: Make test data more realistic
The fields orig_subject and propagate_mode are 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 b3f0922 commit 85cc089

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/api/model/events_test.dart

+8-4
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,25 @@ void main() {
101101
'edit_timestamp': 1718741351,
102102
'stream_id': eg.stream().streamId,
103103
};
104+
final baseMoveJson = { ...baseJson,
105+
'orig_subject': 'foo',
106+
'propagate_mode': 'change_all',
107+
};
104108

105109
test('stream_id -> origStreamId', () {
106-
check(Event.fromJson({ ...baseJson,
110+
check(Event.fromJson({ ...baseMoveJson,
107111
'stream_id': 1,
108112
'new_stream_id': 2,
109-
}) as UpdateMessageEvent)
113+
})).isA<UpdateMessageEvent>()
110114
..origStreamId.equals(1)
111115
..newStreamId.equals(2);
112116
});
113117

114118
test('orig_subject -> origTopic, subject -> newTopic', () {
115-
check(Event.fromJson({ ...baseJson,
119+
check(Event.fromJson({ ...baseMoveJson,
116120
'orig_subject': 'foo',
117121
'subject': 'bar',
118-
}) as UpdateMessageEvent)
122+
})).isA<UpdateMessageEvent>()
119123
..origTopic.equals(const TopicName('foo'))
120124
..newTopic.equals(const TopicName('bar'));
121125
});

0 commit comments

Comments
 (0)