fix: database tests group can't be async
This commit is contained in:
parent
9a39a78a86
commit
f72d298a0b
|
|
@ -27,31 +27,11 @@ import 'package:matrix/matrix.dart';
|
||||||
import 'fake_database.dart';
|
import 'fake_database.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('HiveCollections Database Test', () async {
|
group('HiveCollections Database Test', () {
|
||||||
testDatabase(
|
|
||||||
getHiveCollectionsDatabase(null),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> olmEnabled() async {
|
|
||||||
var olmEnabled = true;
|
|
||||||
try {
|
|
||||||
await olm.init();
|
|
||||||
olm.get_library_version();
|
|
||||||
} catch (e) {
|
|
||||||
olmEnabled = false;
|
|
||||||
}
|
|
||||||
return olmEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void testDatabase(
|
|
||||||
Future<DatabaseApi> futureDatabase,
|
|
||||||
) {
|
|
||||||
late DatabaseApi database;
|
late DatabaseApi database;
|
||||||
late int toDeviceQueueIndex;
|
late int toDeviceQueueIndex;
|
||||||
test('Open', () async {
|
test('Open', () async {
|
||||||
database = await futureDatabase;
|
database = await getHiveCollectionsDatabase(null);
|
||||||
});
|
});
|
||||||
test('transaction', () async {
|
test('transaction', () async {
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
|
@ -231,7 +211,8 @@ void testDatabase(
|
||||||
expect(users.isEmpty, true);
|
expect(users.isEmpty, true);
|
||||||
});
|
});
|
||||||
test('removeEvent', () async {
|
test('removeEvent', () async {
|
||||||
await database.removeEvent('\$event:example.com', '!testroom:example.com');
|
await database.removeEvent(
|
||||||
|
'\$event:example.com', '!testroom:example.com');
|
||||||
final event = await database.getEventById('\$event:example.com',
|
final event = await database.getEventById('\$event:example.com',
|
||||||
Room(id: '!testroom:example.com', client: Client('testclient')));
|
Room(id: '!testroom:example.com', client: Client('testclient')));
|
||||||
expect(event, null);
|
expect(event, null);
|
||||||
|
|
@ -241,7 +222,8 @@ void testDatabase(
|
||||||
expect(result.isEmpty, true);
|
expect(result.isEmpty, true);
|
||||||
});
|
});
|
||||||
test('getInboundGroupSession', () async {
|
test('getInboundGroupSession', () async {
|
||||||
await database.getInboundGroupSession('!testroom:example.com', 'sessionId');
|
await database.getInboundGroupSession(
|
||||||
|
'!testroom:example.com', 'sessionId');
|
||||||
});
|
});
|
||||||
test('getInboundGroupSessionsToUpload', () async {
|
test('getInboundGroupSessionsToUpload', () async {
|
||||||
await database.getInboundGroupSessionsToUpload();
|
await database.getInboundGroupSessionsToUpload();
|
||||||
|
|
@ -490,5 +472,16 @@ void testDatabase(
|
||||||
test('Close', () async {
|
test('Close', () async {
|
||||||
await database.close();
|
await database.close();
|
||||||
});
|
});
|
||||||
return;
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> olmEnabled() async {
|
||||||
|
var olmEnabled = true;
|
||||||
|
try {
|
||||||
|
await olm.init();
|
||||||
|
olm.get_library_version();
|
||||||
|
} catch (e) {
|
||||||
|
olmEnabled = false;
|
||||||
|
}
|
||||||
|
return olmEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue