@@ -463,6 +463,34 @@ void main() {
463463 expect (response.body.ocs.data.parent! .chatMessage! .messageType, spreed.MessageType .commentDeleted);
464464 expect (response.body.ocs.data.parent! .chatMessage! .systemMessage, '' );
465465 });
466+
467+ test ('Clear history' , () async {
468+ final room = await createTestRoom ();
469+
470+ final clearHistoryResponse = await tester.client.spreed.chat.clearHistory (
471+ token: room.token,
472+ );
473+ expect (clearHistoryResponse.body.ocs.data.id, isPositive);
474+ expect (clearHistoryResponse.body.ocs.data.actorType, spreed.ActorType .users);
475+ expect (clearHistoryResponse.body.ocs.data.actorId, 'user1' );
476+ expect (clearHistoryResponse.body.ocs.data.actorDisplayName, 'User One' );
477+ expect (clearHistoryResponse.body.ocs.data.message, 'You cleared the history of the conversation' );
478+ expect (clearHistoryResponse.body.ocs.data.messageType, spreed.MessageType .system);
479+ expect (clearHistoryResponse.body.ocs.data.systemMessage, 'history_cleared' );
480+
481+ final receiveMessagesResponse = await tester.client.spreed.chat.receiveMessages (
482+ token: room.token,
483+ lookIntoFuture: spreed.ChatReceiveMessagesLookIntoFuture .$0,
484+ );
485+ expect (receiveMessagesResponse.body.ocs.data, hasLength (1 ));
486+ expect (receiveMessagesResponse.body.ocs.data[0 ].id, isPositive);
487+ expect (receiveMessagesResponse.body.ocs.data[0 ].actorType, spreed.ActorType .users);
488+ expect (receiveMessagesResponse.body.ocs.data[0 ].actorId, 'user1' );
489+ expect (receiveMessagesResponse.body.ocs.data[0 ].actorDisplayName, 'User One' );
490+ expect (receiveMessagesResponse.body.ocs.data[0 ].message, 'You cleared the history of the conversation' );
491+ expect (receiveMessagesResponse.body.ocs.data[0 ].messageType, spreed.MessageType .system);
492+ expect (receiveMessagesResponse.body.ocs.data[0 ].systemMessage, 'history_cleared' );
493+ });
466494 });
467495
468496 group ('Call' , () {
0 commit comments