From 4c2a748291452c4707f9c3aec18942ce453e8116 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 19 Mar 2021 16:14:23 +0530 Subject: [PATCH] test(persistence): add clear queryCache test in channel query dao Signed-off-by: Sahil Kumar --- .../test/src/dao/channel_query_dao_test.dart | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart index dd9ecf0b..8ee0e0c0 100644 --- a/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart +++ b/packages/stream_chat_persistence/test/src/dao/channel_query_dao_test.dart @@ -35,6 +35,29 @@ void main() { expect(updatedCids, cids); }); + test('clear queryCache before updateChannelQueries', () async { + const filter = { + 'members': { + r'$in': ['testUserId'], + }, + }; + + const cids = ['testCid1', 'testCid2', 'testCid3']; + + final cachedCids = await channelQueryDao.getCachedChannelCids(filter); + expect(cachedCids, isEmpty); + + // Updating channel queries + await channelQueryDao.updateChannelQueries( + filter, + cids, + clearQueryCache: true, + ); + + final updatedCids = await channelQueryDao.getCachedChannelCids(filter); + expect(updatedCids, cids); + }); + test('getCachedChannelCids', () async { const filter = { 'members': {