refactor: Remove FluffyClient and make it no longer static
This commit is contained in:
parent
6d4af6be05
commit
2320f6b707
8 changed files with 71 additions and 67 deletions
|
|
@ -2,8 +2,15 @@ import 'package:fluffychat/pages/homeserver_picker.dart';
|
|||
import 'package:fluffychat/main.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'utils/test_client.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Test if the widget can be created', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(FluffyChatApp(testWidget: HomeserverPicker()));
|
||||
await tester.pumpWidget(
|
||||
FluffyChatApp(
|
||||
client: await prepareTestClient(),
|
||||
testWidget: HomeserverPicker(),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,30 @@
|
|||
import 'package:fluffychat/utils/database/flutter_famedly_sdk_hive_database.dart';
|
||||
import 'package:matrix/encryption/utils/key_verification.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/fluffy_client.dart';
|
||||
import 'package:matrix_api_lite/fake_matrix_api.dart';
|
||||
|
||||
Future<FluffyClient> testClient({
|
||||
Future<Client> prepareTestClient({
|
||||
bool loggedIn = false,
|
||||
String homeserver = 'https://fakeserver.notexisting',
|
||||
String id = 'FluffyChat Widget Test',
|
||||
}) async {
|
||||
final client = FluffyClient(testMode: true);
|
||||
final client = Client(
|
||||
'FluffyChat Widget Tests',
|
||||
httpClient: FakeMatrixApi(),
|
||||
enableE2eeRecovery: true,
|
||||
verificationMethods: {
|
||||
KeyVerificationMethod.numbers,
|
||||
KeyVerificationMethod.emoji,
|
||||
},
|
||||
importantStateEvents: <String>{
|
||||
'im.ponies.room_emotes', // we want emotes to work properly
|
||||
},
|
||||
databaseBuilder: FlutterFamedlySdkHiveDatabase.hiveDatabaseBuilder,
|
||||
supportedLoginTypes: {
|
||||
AuthenticationTypes.password,
|
||||
AuthenticationTypes.sso
|
||||
},
|
||||
);
|
||||
if (homeserver != null) {
|
||||
await client.checkHomeserver(homeserver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@
|
|||
import 'package:fluffychat/main.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'utils/test_client.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Test if the app starts', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(FluffyChatApp());
|
||||
await tester.pumpWidget(FluffyChatApp(
|
||||
client: await prepareTestClient(),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue