@@ -59,6 +59,7 @@ const readLastMessageChannelData = () => {
5959 generateMessage ( { created_at : new Date ( 2 ) } ) ,
6060 ] ;
6161 return {
62+ channel : { config : { read_events : true } } ,
6263 messages,
6364 read : [
6465 {
@@ -390,6 +391,35 @@ describe('useMarkRead', () => {
390391 expect ( markRead ) . not . toHaveBeenCalled ( ) ;
391392 } ) ;
392393
394+ it ( 'should not increase unread count if the read events are disabled' , async ( ) => {
395+ const channelData = {
396+ ...readLastMessageChannelData ( ) ,
397+ channel : { config : { read_events : false } } ,
398+ } ;
399+ const {
400+ channels : [ channel ] ,
401+ client,
402+ } = await initClientWithChannels ( {
403+ channelsData : [ channelData ] ,
404+ customUser : channelData . read [ 0 ] . user ,
405+ } ) ;
406+
407+ await render ( {
408+ channel,
409+ client,
410+ params : {
411+ ...shouldMarkReadParams ,
412+ isMessageListScrolledToBottom : false ,
413+ } ,
414+ } ) ;
415+
416+ await act ( ( ) => {
417+ dispatchMessageNewEvent ( client , generateMessage ( ) , channel ) ;
418+ } ) ;
419+ expect ( setChannelUnreadUiState ) . toHaveBeenCalledTimes ( 0 ) ;
420+ expect ( markRead ) . not . toHaveBeenCalled ( ) ;
421+ } ) ;
422+
393423 it ( 'should not mark channel read from thread message list' , async ( ) => {
394424 const channelData = readLastMessageChannelData ( ) ;
395425 const {
0 commit comments