From 148f52ad842937d26e258f86a12f48d22cb6914b Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 27 Oct 2023 14:41:20 +0100 Subject: [PATCH] api test: Add test for markAllAsRead --- test/api/route/messages_test.dart | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/api/route/messages_test.dart b/test/api/route/messages_test.dart index c840c84721..de4824696b 100644 --- a/test/api/route/messages_test.dart +++ b/test/api/route/messages_test.dart @@ -454,6 +454,28 @@ void main() { }); }); + group('markAllAsRead', () { + Future checkMarkAllAsRead( + FakeApiConnection connection, { + required Map expected, + }) async { + connection.prepare(json: MarkAllAsReadResult(complete: true).toJson()); + final result = await markAllAsRead(connection); + check(connection.lastRequest).isNotNull().isA() + ..method.equals('POST') + ..url.path.equals('/api/v1/mark_all_as_read') + ..bodyFields.deepEquals(expected); + return result; + } + + test('smoke', () { + return FakeApiConnection.with_((connection) async { + final result = await checkMarkAllAsRead(connection, expected: {}); + check(result.complete).isTrue(); + }); + }); + }); + group('markStreamAsRead', () { Future checkMarkStreamAsRead( FakeApiConnection connection, {