* feat: Added tests * feat: Added header test * feat: Added new tests * fix * feat: Added test, fmt * feat: Added delete test * added system and unread ind tests * fix: analysis * added new tests * fix: analysis * added tests * add attachment actions modal tests * fix analysis * fix analysis * add backbutton tests * fix analysis * increase timeout * add channelheader tests * add infotile tests * add reactions modal and channel unread indicator tests * add golden test for reaction bubble * add dark tests * add system message golden * add deletd message golden * add message action modal tests * update goldens * update workflow runner * update goldens * remove channel unread indicator in favor of unread indicator * move file and media screen to sample app * add channel image tesst * add channel_list_header test * add thread_header test * bump up test threashold * fix review Co-authored-by: Salvatore Giordano <[email protected]>
55 lines
1.8 KiB
Dart
55 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|
|
|
import 'mocks.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'it should show correct message text',
|
|
(WidgetTester tester) async {
|
|
final client = MockClient();
|
|
final clientState = MockClientState();
|
|
final channel = MockChannel();
|
|
final channelState = MockChannelState();
|
|
final lastMessageAt = DateTime.parse('2020-06-22 12:00:00');
|
|
final themeData = ThemeData();
|
|
final streamTheme = StreamChatThemeData.getDefaultTheme(themeData);
|
|
|
|
when(client.state).thenReturn(clientState);
|
|
when(clientState.user).thenReturn(OwnUser(id: 'user-id'));
|
|
when(channel.lastMessageAt).thenReturn(lastMessageAt);
|
|
when(channel.state).thenReturn(channelState);
|
|
when(channel.client).thenReturn(client);
|
|
when(channel.isMuted).thenReturn(false);
|
|
when(channel.isMutedStream).thenAnswer((i) => Stream.value(false));
|
|
when(channel.extraDataStream).thenAnswer((i) => Stream.value({
|
|
'name': 'test',
|
|
}));
|
|
when(channel.extraData).thenReturn({
|
|
'name': 'test',
|
|
});
|
|
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: StreamChat(
|
|
client: client,
|
|
child: StreamChannel(
|
|
channel: channel,
|
|
child: Scaffold(
|
|
body: MessageText(
|
|
message: Message(
|
|
text: 'demo',
|
|
),
|
|
messageTheme: streamTheme.otherMessageTheme),
|
|
),
|
|
),
|
|
),
|
|
));
|
|
|
|
expect(find.byType(MarkdownBody), findsOneWidget);
|
|
},
|
|
);
|
|
}
|