fix(llc, ui): fix failing tests
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -220,7 +220,7 @@ class Message extends Equatable {
|
|||||||
final DateTime? deletedAt;
|
final DateTime? deletedAt;
|
||||||
|
|
||||||
/// A Map of translations.
|
/// A Map of translations.
|
||||||
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
|
@JsonKey(includeIfNull: false)
|
||||||
final Map<String, String>? i18n;
|
final Map<String, String>? i18n;
|
||||||
|
|
||||||
/// Known top level fields.
|
/// Known top level fields.
|
||||||
|
|||||||
@@ -110,6 +110,6 @@ Map<String, dynamic> _$MessageToJson(Message instance) {
|
|||||||
val['pinned_by'] = readonly(instance.pinnedBy);
|
val['pinned_by'] = readonly(instance.pinnedBy);
|
||||||
val['extra_data'] = instance.extraData;
|
val['extra_data'] = instance.extraData;
|
||||||
writeNotNull('deleted_at', readonly(instance.deletedAt));
|
writeNotNull('deleted_at', readonly(instance.deletedAt));
|
||||||
writeNotNull('i18n', readonly(instance.i18n));
|
writeNotNull('i18n', instance.i18n);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ class User extends Equatable {
|
|||||||
/// The language this user prefers.
|
/// The language this user prefers.
|
||||||
///
|
///
|
||||||
/// Defaults to 'en'.
|
/// Defaults to 'en'.
|
||||||
@JsonKey(defaultValue: 'en')
|
@JsonKey(
|
||||||
|
includeIfNull: false,
|
||||||
|
toJson: Serializer.readOnly,
|
||||||
|
defaultValue: 'en',
|
||||||
|
)
|
||||||
final String language;
|
final String language;
|
||||||
|
|
||||||
/// Shortcut for user name
|
/// Shortcut for user name
|
||||||
|
|||||||
@@ -48,6 +48,6 @@ Map<String, dynamic> _$UserToJson(User instance) {
|
|||||||
writeNotNull('online', readonly(instance.online));
|
writeNotNull('online', readonly(instance.online));
|
||||||
writeNotNull('banned', readonly(instance.banned));
|
writeNotNull('banned', readonly(instance.banned));
|
||||||
val['extra_data'] = instance.extraData;
|
val['extra_data'] = instance.extraData;
|
||||||
val['language'] = instance.language;
|
writeNotNull('language', readonly(instance.language));
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ void main() {
|
|||||||
testWidgets(
|
testWidgets(
|
||||||
'it should show correct message text',
|
'it should show correct message text',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
|
final currentUser = OwnUser(id: 'user-id');
|
||||||
final client = MockClient();
|
final client = MockClient();
|
||||||
final clientState = MockClientState();
|
final clientState = MockClientState();
|
||||||
final channel = MockChannel();
|
final channel = MockChannel();
|
||||||
@@ -43,7 +44,9 @@ void main() {
|
|||||||
final streamTheme = StreamChatThemeData.fromTheme(themeData);
|
final streamTheme = StreamChatThemeData.fromTheme(themeData);
|
||||||
|
|
||||||
when(() => client.state).thenReturn(clientState);
|
when(() => client.state).thenReturn(clientState);
|
||||||
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id'));
|
when(() => clientState.currentUser).thenReturn(currentUser);
|
||||||
|
when(() => clientState.currentUserStream)
|
||||||
|
.thenAnswer((_) => Stream.value(currentUser));
|
||||||
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
|
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
|
||||||
when(() => channel.state).thenReturn(channelState);
|
when(() => channel.state).thenReturn(channelState);
|
||||||
when(() => channel.client).thenReturn(client);
|
when(() => channel.client).thenReturn(client);
|
||||||
@@ -176,6 +179,7 @@ void main() {
|
|||||||
testGoldens(
|
testGoldens(
|
||||||
'control test',
|
'control test',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
|
final currentUser = OwnUser(id: 'user-id');
|
||||||
final client = MockClient();
|
final client = MockClient();
|
||||||
final clientState = MockClientState();
|
final clientState = MockClientState();
|
||||||
final channel = MockChannel();
|
final channel = MockChannel();
|
||||||
@@ -185,7 +189,9 @@ void main() {
|
|||||||
final streamTheme = StreamChatThemeData.fromTheme(themeData);
|
final streamTheme = StreamChatThemeData.fromTheme(themeData);
|
||||||
|
|
||||||
when(() => client.state).thenReturn(clientState);
|
when(() => client.state).thenReturn(clientState);
|
||||||
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id'));
|
when(() => clientState.currentUser).thenReturn(currentUser);
|
||||||
|
when(() => clientState.currentUserStream)
|
||||||
|
.thenAnswer((_) => Stream.value(currentUser));
|
||||||
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
|
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
|
||||||
when(() => channel.state).thenReturn(channelState);
|
when(() => channel.state).thenReturn(channelState);
|
||||||
when(() => channel.client).thenReturn(client);
|
when(() => channel.client).thenReturn(client);
|
||||||
@@ -209,14 +215,18 @@ cool.''';
|
|||||||
|
|
||||||
await tester.pumpWidgetBuilder(
|
await tester.pumpWidgetBuilder(
|
||||||
materialAppWrapper()(SimpleFrame(
|
materialAppWrapper()(SimpleFrame(
|
||||||
child: StreamChannel(
|
child: StreamChat(
|
||||||
channel: channel,
|
client: client,
|
||||||
child: Scaffold(
|
connectivityStream: Stream.value(ConnectivityResult.wifi),
|
||||||
body: MessageText(
|
child: StreamChannel(
|
||||||
message: Message(
|
channel: channel,
|
||||||
text: messageText,
|
child: Scaffold(
|
||||||
|
body: MessageText(
|
||||||
|
message: Message(
|
||||||
|
text: messageText,
|
||||||
|
),
|
||||||
|
messageTheme: streamTheme.otherMessageTheme,
|
||||||
),
|
),
|
||||||
messageTheme: streamTheme.otherMessageTheme,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user