Skip to content

Commit

Permalink
api test: Add test for markTopicAsRead
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Oct 27, 2023
1 parent 9043aab commit 8cc6f35
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/api/route/messages_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,35 @@ void main() {
});
});

group('markTopicAsRead', () {
Future<void> checkMarkTopicAsRead(
FakeApiConnection connection, {
required int streamId,
required String topicName,
required Map<String, String> expected,
}) async {
connection.prepare(json: {});
await markTopicAsRead(connection,
streamId: streamId, topicName: topicName);
check(connection.lastRequest).isNotNull().isA<http.Request>()
..method.equals('POST')
..url.path.equals('/api/v1/mark_topic_as_read')
..bodyFields.deepEquals(expected);
}

test('smoke', () {
return FakeApiConnection.with_((connection) async {
await checkMarkTopicAsRead(connection,
streamId: 10,
topicName: 'topic',
expected: {
'stream_id': '10',
'topic_name': 'topic',
});
});
});
});

group('updateMessageFlags', () {
Future<UpdateMessageFlagsResult> checkUpdateMessageFlags(
FakeApiConnection connection, {
Expand Down

0 comments on commit 8cc6f35

Please sign in to comment.