@@ -6357,6 +6357,71 @@ void main() {
63576357 });
63586358 });
63596359
6360+ group ('Channel filterTags' , () {
6361+ late final client = MockStreamChatClient ();
6362+ const channelId = 'test-channel-id' ;
6363+ const channelType = 'test-channel-type' ;
6364+
6365+ setUpAll (() {
6366+ // detached loggers
6367+ when (() => client.detachedLogger (any ())).thenAnswer ((invocation) {
6368+ final name = invocation.positionalArguments.first;
6369+ return _createLogger (name);
6370+ });
6371+
6372+ final retryPolicy = RetryPolicy (
6373+ shouldRetry: (_, __, ___) => false ,
6374+ delayFactor: Duration .zero,
6375+ );
6376+ when (() => client.retryPolicy).thenReturn (retryPolicy);
6377+
6378+ // fake clientState
6379+ final clientState = FakeClientState ();
6380+ when (() => client.state).thenReturn (clientState);
6381+
6382+ // client logger
6383+ when (() => client.logger).thenReturn (_createLogger ('mock-client-logger' ));
6384+ });
6385+
6386+ test ('should return filterTags from channel state' , () {
6387+ final channelModel = ChannelModel (
6388+ id: channelId,
6389+ type: channelType,
6390+ filterTags: ['tag1' , 'tag2' ],
6391+ );
6392+
6393+ final channelState = ChannelState (channel: channelModel);
6394+ final testChannel = Channel .fromState (client, channelState);
6395+ addTearDown (testChannel.dispose);
6396+
6397+ expect (testChannel.filterTags, equals (['tag1' , 'tag2' ]));
6398+ });
6399+
6400+ test ('should update filterTags when channel state is updated' , () {
6401+ final channelModel = ChannelModel (
6402+ id: channelId,
6403+ type: channelType,
6404+ filterTags: ['tag1' , 'tag2' ],
6405+ );
6406+
6407+ final channelState = ChannelState (channel: channelModel);
6408+ final testChannel = Channel .fromState (client, channelState);
6409+ addTearDown (testChannel.dispose);
6410+
6411+ expect (testChannel.filterTags, equals (['tag1' , 'tag2' ]));
6412+
6413+ final updatedChannel = channelModel.copyWith (
6414+ filterTags: ['tag3' , 'tag4' , 'tag5' ],
6415+ );
6416+
6417+ testChannel.state? .updateChannelState (
6418+ testChannel.state! .channelState.copyWith (channel: updatedChannel),
6419+ );
6420+
6421+ expect (testChannel.filterTags, equals (['tag3' , 'tag4' , 'tag5' ]));
6422+ });
6423+ });
6424+
63606425 group ('Typing Indicator' , () {
63616426 const channelId = 'test-channel-id' ;
63626427 const channelType = 'test-channel-type' ;
0 commit comments