Skip to content

Commit

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

group('markAllAsRead', () {
Future<MarkAllAsReadResult> checkMarkAllAsRead(
FakeApiConnection connection, {
required Map<String, String> expected,
}) async {
connection.prepare(json: MarkAllAsReadResult(complete: true).toJson());
final result = await markAllAsRead(connection);
check(connection.lastRequest).isNotNull().isA<http.Request>()
..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<void> checkMarkStreamAsRead(
FakeApiConnection connection, {
Expand Down

0 comments on commit 148f52a

Please sign in to comment.