@@ -4361,56 +4361,8 @@ void main() {
43614361 expect (updatedRead? .lastRead.isAtSameMomentAs (DateTime (2022 )), isTrue);
43624362 });
43634363
4364- test ('should update read state on notification mark read event' ,
4365- () async {
4366- // Create the current read state
4367- final currentUser = User (id: 'test-user' );
4368- final currentRead = Read (
4369- user: currentUser,
4370- lastRead: DateTime (2020 ),
4371- unreadMessages: 10 ,
4372- );
4373-
4374- // Setup initial read state
4375- channel.state? .updateChannelState (
4376- channel.state! .channelState.copyWith (
4377- read: [currentRead],
4378- ),
4379- );
4380-
4381- // Verify initial state
4382- final read = channel.state? .read.first;
4383- expect (read? .user.id, 'test-user' );
4384- expect (read? .unreadMessages, 10 );
4385- expect (read? .lastReadMessageId, isNull);
4386- expect (read? .lastRead.isAtSameMomentAs (DateTime (2020 )), isTrue);
4387-
4388- // Create mark read notification event
4389- final markReadEvent = Event (
4390- cid: channel.cid,
4391- type: EventType .notificationMarkRead,
4392- user: currentUser,
4393- createdAt: DateTime (2022 ),
4394- unreadMessages: 0 ,
4395- lastReadMessageId: 'message-123' ,
4396- );
4397-
4398- // Dispatch event
4399- client.addEvent (markReadEvent);
4400-
4401- // Wait for event to be processed
4402- await Future .delayed (Duration .zero);
4403-
4404- // Verify read state is updated
4405- final updatedRead = channel.state? .read.first;
4406- expect (updatedRead? .user.id, 'test-user' );
4407- expect (updatedRead? .unreadMessages, 0 );
4408- expect (updatedRead? .lastReadMessageId, 'message-123' );
4409- expect (updatedRead? .lastRead.isAtSameMomentAs (DateTime (2022 )), isTrue);
4410- });
4411-
44124364 test (
4413- 'should add a new read state if not exist on notification mark read' ,
4365+ 'should add a new read state if not exist on message read event ' ,
44144366 () async {
44154367 // Create the current read state
44164368 final currentUser = User (id: 'test-user' );
@@ -4422,7 +4374,7 @@ void main() {
44224374 // Create mark read notification event
44234375 final markReadEvent = Event (
44244376 cid: channel.cid,
4425- type: EventType .notificationMarkRead ,
4377+ type: EventType .messageRead ,
44264378 user: currentUser,
44274379 createdAt: DateTime (2022 ),
44284380 unreadMessages: 0 ,
0 commit comments