Skip to content

Commit

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

group('markStreamAsRead', () {
Future<void> checkMarkStreamAsRead(
FakeApiConnection connection, {
required int streamId,
required Map<String, String> expected,
}) async {
connection.prepare(json: {});
await markStreamAsRead(connection, streamId: streamId);
check(connection.lastRequest).isNotNull().isA<http.Request>()
..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<void> checkMarkTopicAsRead(
FakeApiConnection connection, {
Expand Down

0 comments on commit 21d0c1e

Please sign in to comment.