From 21d0c1ed5611679c198795d11ab7ecd788738db3 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 27 Oct 2023 14:38:19 +0100 Subject: [PATCH] api test: Add test for markStreamAsRead --- test/api/route/messages_test.dart | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/api/route/messages_test.dart b/test/api/route/messages_test.dart index 2cb174e1cb..0ac131bfac 100644 --- a/test/api/route/messages_test.dart +++ b/test/api/route/messages_test.dart @@ -454,6 +454,29 @@ void main() { }); }); + group('markStreamAsRead', () { + Future checkMarkStreamAsRead( + FakeApiConnection connection, { + required int streamId, + required Map expected, + }) async { + connection.prepare(json: {}); + await markStreamAsRead(connection, streamId: streamId); + check(connection.lastRequest).isNotNull().isA() + ..method.equals('POST') + ..url.path.equals('/api/v1/mark_stream_as_read') + ..bodyFields.deepEquals(expected); + } + + test('smoke', () { + return FakeApiConnection.with_((connection) async { + await checkMarkStreamAsRead(connection, + streamId: 10, + expected: {'stream_id': '10'}); + }); + }); + }); + group('markTopicAsRead', () { Future checkMarkTopicAsRead( FakeApiConnection connection, {