From 3a0102aaf614718d0d6a3908a0b4aafb062efa95 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 28 Feb 2025 17:31:59 +0530 Subject: [PATCH] fix: fix more test --- packages/stream_chat/lib/src/core/models/message.dart | 1 + packages/stream_chat/lib/src/core/models/message.g.dart | 1 - packages/stream_chat/test/fixtures/channel_state.json | 6 ++++-- packages/stream_chat/test/fixtures/message_to_json.json | 3 --- .../test/src/core/models/channel_state_test.dart | 6 ++++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 4d2d73079..b3a8e890b 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -239,6 +239,7 @@ class Message extends Equatable { final String? _pollId; /// The list of those users who have restricted visibility for this message. + @JsonKey(includeToJson: false) final List? restrictedVisibility; /// Message custom extraData. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index acb287b12..2a0ff4e71 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -94,6 +94,5 @@ Map _$MessageToJson(Message instance) => { 'pinned': instance.pinned, 'pin_expires': instance.pinExpires?.toIso8601String(), 'poll_id': instance.pollId, - 'restricted_visibility': instance.restrictedVisibility, 'extra_data': instance.extraData, }; diff --git a/packages/stream_chat/test/fixtures/channel_state.json b/packages/stream_chat/test/fixtures/channel_state.json index 481465433..528259be0 100644 --- a/packages/stream_chat/test/fixtures/channel_state.json +++ b/packages/stream_chat/test/fixtures/channel_state.json @@ -1,4 +1,3 @@ - { "channel": { "id": "dev", @@ -79,7 +78,10 @@ "pinned_at": null, "pin_expires": null, "pinned_by": null, - "poll_id": null + "poll_id": null, + "restricted_visibility": [ + "user-id-3" + ] }, { "id": "dry-meadow-0-e8e74482-b4cd-48db-9d1e-30e6c191786f", diff --git a/packages/stream_chat/test/fixtures/message_to_json.json b/packages/stream_chat/test/fixtures/message_to_json.json index c4568628d..8388eb822 100644 --- a/packages/stream_chat/test/fixtures/message_to_json.json +++ b/packages/stream_chat/test/fixtures/message_to_json.json @@ -23,8 +23,5 @@ "pin_expires": null, "poll_id": null, "show_in_channel": true, - "restricted_visibility": [ - "user-id-3" - ], "hey": "test" } \ No newline at end of file diff --git a/packages/stream_chat/test/src/core/models/channel_state_test.dart b/packages/stream_chat/test/src/core/models/channel_state_test.dart index 269225c9d..ca70b79be 100644 --- a/packages/stream_chat/test/src/core/models/channel_state_test.dart +++ b/packages/stream_chat/test/src/core/models/channel_state_test.dart @@ -42,6 +42,10 @@ void main() { DateTime.parse('2020-01-29T03:23:02.843948Z'), ); expect(channelState.messages![0].user, isA()); + expect( + channelState.messages![0].restrictedVisibility, + isA>(), + ); expect(channelState.watcherCount, 5); }); @@ -59,8 +63,6 @@ void main() { watchers: [], ); - print(jsonEncode(channelState.messages?.first)); - expect( channelState.toJson(), jsonFixture('channel_state_to_json.json'),