fix:
This commit is contained in:
parent
5da0180f1f
commit
01eb851364
|
|
@ -24,6 +24,7 @@ export 'package:matrix_api_lite/matrix_api_lite.dart';
|
||||||
export 'src/client.dart';
|
export 'src/client.dart';
|
||||||
export 'src/database/database_api.dart';
|
export 'src/database/database_api.dart';
|
||||||
export 'src/database/hive_database.dart';
|
export 'src/database/hive_database.dart';
|
||||||
|
export 'src/database/fluffybox_database.dart';
|
||||||
export 'src/event.dart';
|
export 'src/event.dart';
|
||||||
export 'src/event_status.dart';
|
export 'src/event_status.dart';
|
||||||
export 'src/room.dart';
|
export 'src/room.dart';
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -23,6 +23,7 @@ dependencies:
|
||||||
slugify: ^2.0.0
|
slugify: ^2.0.0
|
||||||
html: ^0.15.0
|
html: ^0.15.0
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
fluffybox: ^0.3.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
dart_code_metrics: ^4.4.0
|
dart_code_metrics: ^4.4.0
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ import 'package:olm/olm.dart' as olm;
|
||||||
import 'fake_database.dart';
|
import 'fake_database.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
group('FluffyBox Database Test', () {
|
||||||
|
testDatabase(
|
||||||
|
getFluffyBoxDatabase(null),
|
||||||
|
);
|
||||||
|
});
|
||||||
group('Hive Database Test', () {
|
group('Hive Database Test', () {
|
||||||
testDatabase(
|
testDatabase(
|
||||||
getHiveDatabase(null),
|
getHiveDatabase(null),
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,25 @@ import 'package:matrix/matrix.dart';
|
||||||
import 'package:matrix/src/database/hive_database.dart';
|
import 'package:matrix/src/database/hive_database.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:matrix/src/database/fluffybox_database.dart';
|
||||||
|
|
||||||
Future<DatabaseApi> getDatabase(Client? _) => getHiveDatabase(_);
|
Future<DatabaseApi> getDatabase(Client? _) => getHiveDatabase(_);
|
||||||
|
|
||||||
bool hiveInitialized = false;
|
bool hiveInitialized = false;
|
||||||
|
|
||||||
|
Future<FluffyBoxDatabase> getFluffyBoxDatabase(Client? c) async {
|
||||||
|
final fileSystem = MemoryFileSystem();
|
||||||
|
final testHivePath =
|
||||||
|
'${fileSystem.path}/build/.test_store/${Random().nextDouble()}';
|
||||||
|
Directory(testHivePath).createSync(recursive: true);
|
||||||
|
final db = FluffyBoxDatabase(
|
||||||
|
'unit_test.${c?.hashCode}',
|
||||||
|
testHivePath,
|
||||||
|
);
|
||||||
|
await db.open();
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
Future<FamedlySdkHiveDatabase> getHiveDatabase(Client? c) async {
|
Future<FamedlySdkHiveDatabase> getHiveDatabase(Client? c) async {
|
||||||
if (!hiveInitialized) {
|
if (!hiveInitialized) {
|
||||||
final fileSystem = MemoryFileSystem();
|
final fileSystem = MemoryFileSystem();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue