File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
package/src/__tests__/offline-support Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -565,7 +565,14 @@ export const Generic = () => {
565565 const messagesRows = await BetterSqlite . selectFromTable ( 'messages' ) ;
566566 const matchingMessagesRows = messagesRows . filter ( ( m ) => m . cid === channelToTruncate . cid ) ;
567567
568+ const readsRows = await BetterSqlite . selectFromTable ( 'reads' ) ;
569+ const matchingReadRows = readsRows . filter (
570+ ( r ) => r . userId === chatClient . userID && r . cid === channelToTruncate . cid ,
571+ ) ;
572+
568573 expect ( matchingMessagesRows . length ) . toBe ( 0 ) ;
574+ expect ( matchingReadRows . length ) . toBe ( 1 ) ;
575+ expect ( matchingReadRows [ 0 ] . unreadMessages ) . toBe ( 0 ) ;
569576 } ) ;
570577 } ) ;
571578
@@ -600,7 +607,16 @@ export const Generic = () => {
600607 const messagesRows = await BetterSqlite . selectFromTable ( 'messages' ) ;
601608 const matchingMessagesRows = messagesRows . filter ( ( m ) => m . cid === channelToTruncate . cid ) ;
602609
603- expect ( matchingMessagesRows . length ) . toBe ( messages . length / 2 - 1 ) ;
610+ const readsRows = await BetterSqlite . selectFromTable ( 'reads' ) ;
611+ const matchingReadRows = readsRows . filter (
612+ ( r ) => r . userId === chatClient . userID && r . cid === channelToTruncate . cid ,
613+ ) ;
614+
615+ const messagesLeft = messages . length / 2 - 1 ;
616+
617+ expect ( matchingMessagesRows . length ) . toBe ( messagesLeft ) ;
618+ expect ( matchingReadRows . length ) . toBe ( 1 ) ;
619+ expect ( matchingReadRows [ 0 ] . unreadMessages ) . toBe ( messagesLeft ) ;
604620 } ) ;
605621 } ) ;
606622
You can’t perform that action at this time.
0 commit comments