refactor: MVC archive

This commit is contained in:
Christian Pauly 2021-04-12 18:33:43 +02:00
commit bff8a2629a
8 changed files with 88 additions and 27 deletions

15
test/archive_test.dart Normal file
View file

@ -0,0 +1,15 @@
/*import 'package:fluffychat/controllers/archive_controller.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: Archive(),
testClient: await testClient(loggedIn: true),
));
});
}
*/

View file

@ -0,0 +1,20 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/fluffy_client.dart';
Future<FluffyClient> testClient({
bool loggedIn = false,
String homeserver = 'https://fakeserver.notexisting',
String id = 'FluffyChat Widget Test',
}) async {
final client = FluffyClient(testMode: true);
if (homeserver != null) {
await client.checkHomeserver(homeserver);
}
if (loggedIn) {
await client.login(
identifier: AuthenticationUserIdentifier(user: '@alice:example.invalid'),
password: '1234',
);
}
return client;
}

View file

@ -5,11 +5,11 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:fluffychat/main.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Test if the app starts', (WidgetTester tester) async {
// Build our app and trigger a frame.
//await tester.pumpWidget(App());
await tester.pumpWidget(FluffyChatApp());
});
}