fix tests

This commit is contained in:
Salvatore Giordano
2021-06-17 14:03:35 +02:00
parent 5cd9a3be53
commit c37faddd2e
4 changed files with 18 additions and 21 deletions
@@ -60,10 +60,6 @@ void main() {
) )
])); ]));
when(() => channelState.typingEvents).thenReturn([]);
when(() => channelState.typingEventsStream)
.thenAnswer((_) => Stream.value([]));
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: StreamChat( home: StreamChat(
client: client, client: client,
@@ -53,15 +53,15 @@ void main() {
user: User(id: 'other-user'), user: User(id: 'other-user'),
) )
])); ]));
when(() => channelState.typingEvents).thenAnswer((i) => {
when(() => channelState.typingEvents).thenAnswer((i) => [ User(id: 'other-user', extraData: {'name': 'demo'}):
User(id: 'other-user', extraData: {'name': 'demo'}) const Event(type: EventType.typingStart),
]); });
when(() => channelState.typingEventsStream) when(() => channelState.typingEventsStream)
.thenAnswer((i) => Stream.value([ .thenAnswer((i) => Stream.value({
User(id: 'other-user', extraData: {'name': 'demo'}), User(id: 'other-user', extraData: {'name': 'demo'}):
User(id: 'other-user', extraData: {'name': 'demo'}), const Event(type: EventType.typingStart),
])); }));
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: StreamChat( home: StreamChat(
@@ -23,8 +23,8 @@ class MockChannel extends Mock implements Channel {
class MockChannelState extends Mock implements ChannelClientState { class MockChannelState extends Mock implements ChannelClientState {
MockChannelState() { MockChannelState() {
when(() => typingEvents).thenReturn([]); when(() => typingEvents).thenReturn({});
when(() => typingEventsStream).thenAnswer((_) => Stream.value([])); when(() => typingEventsStream).thenAnswer((_) => Stream.value({}));
} }
} }
@@ -53,14 +53,15 @@ void main() {
) )
])); ]));
when(() => channelState.typingEvents).thenAnswer((i) => [ when(() => channelState.typingEvents).thenAnswer((i) => {
User(id: 'other-user', extraData: {'name': 'demo'}) User(id: 'other-user', extraData: {'name': 'demo'}):
]); const Event(type: EventType.typingStart),
});
when(() => channelState.typingEventsStream) when(() => channelState.typingEventsStream)
.thenAnswer((i) => Stream.value([ .thenAnswer((i) => Stream.value({
User(id: 'other-user', extraData: {'name': 'demo'}), User(id: 'other-user', extraData: {'name': 'demo'}):
User(id: 'other-user', extraData: {'name': 'demo'}), const Event(type: EventType.typingStart),
])); }));
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: StreamChat( home: StreamChat(