fix tests

This commit is contained in:
Salvatore Giordano
2021-05-06 14:52:38 +02:00
parent 777eaa23fc
commit fff82c8455
9 changed files with 52 additions and 71 deletions
@@ -46,7 +46,7 @@ void main() {
await tester.pumpWidget(channelListCore);
expect(find.byKey(channelListCoreKey), findsNothing);
expect(tester.takeException(), isInstanceOf<Exception>());
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -46,7 +46,7 @@ void main() {
expect(find.byKey(channelsBlocKey), findsNothing);
expect(find.byKey(childKey), findsNothing);
expect(tester.takeException(), isInstanceOf<Exception>());
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -78,7 +78,7 @@ void main() {
await tester.pumpWidget(messageListCore);
expect(find.byKey(messageListCoreKey), findsNothing);
expect(tester.takeException(), isInstanceOf<Exception>());
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -35,27 +35,12 @@ void main() {
'messageSearchBlocState.search() should throw if used where '
'StreamChat is not present in the widget tree',
(tester) async {
const messageSearchBlocKey = Key('messageSearchBloc');
const childKey = Key('child');
final messageSearchBloc = MessageSearchBloc(
key: messageSearchBlocKey,
child: Offstage(key: childKey),
child: Offstage(),
);
await tester.pumpWidget(messageSearchBloc);
expect(find.byKey(messageSearchBlocKey), findsOneWidget);
expect(find.byKey(childKey), findsOneWidget);
final usersBlocState = tester.state<MessageSearchBlocState>(
find.byKey(messageSearchBlocKey),
);
try {
await usersBlocState.search(filter: testFilter);
} catch (e) {
expect(e, isInstanceOf<Exception>());
}
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -45,7 +45,7 @@ void main() {
await tester.pumpWidget(messageSearchListCore);
expect(find.byKey(messageSearchListCoreKey), findsNothing);
expect(tester.takeException(), isInstanceOf<Exception>());
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -49,7 +49,7 @@ void main() {
await tester.pumpWidget(userListCore);
expect(find.byKey(userListCoreKey), findsNothing);
expect(tester.takeException(), isInstanceOf<Exception>());
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);
@@ -35,27 +35,12 @@ void main() {
'usersBlocState.queryUsers() should throw if used where '
'StreamChat is not present in the widget tree',
(tester) async {
const usersBlocKey = Key('usersBloc');
const childKey = Key('child');
final usersBloc = UsersBloc(
key: usersBlocKey,
child: Offstage(key: childKey),
child: Offstage(),
);
await tester.pumpWidget(usersBloc);
expect(find.byKey(usersBlocKey), findsOneWidget);
expect(find.byKey(childKey), findsOneWidget);
final usersBlocState = tester.state<UsersBlocState>(
find.byKey(usersBlocKey),
);
try {
await usersBlocState.queryUsers();
} catch (e) {
expect(e, isInstanceOf<Exception>());
}
expect(tester.takeException(), isInstanceOf<AssertionError>());
},
);