diff --git a/test/fake_database.dart b/test/fake_database.dart index b0fc07bd..4f21574c 100644 --- a/test/fake_database.dart +++ b/test/fake_database.dart @@ -16,11 +16,4 @@ * along with this program. If not, see . */ -import 'package:famedlysdk/famedlysdk.dart'; -import 'package:moor/moor.dart'; -import 'package:moor/ffi.dart' as moor; - -Future getDatabase(Client _) async { - moorRuntimeOptions.dontWarnAboutMultipleDatabases = true; - return Database(moor.VmDatabase.memory()); -} +export 'fake_database_native.dart' if (dart.library.js) 'fake_database_web.dart'; diff --git a/test/fake_database_native.dart b/test/fake_database_native.dart new file mode 100644 index 00000000..b0fc07bd --- /dev/null +++ b/test/fake_database_native.dart @@ -0,0 +1,26 @@ +/* + * Famedly Matrix SDK + * Copyright (C) 2019, 2020 Famedly GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:famedlysdk/famedlysdk.dart'; +import 'package:moor/moor.dart'; +import 'package:moor/ffi.dart' as moor; + +Future getDatabase(Client _) async { + moorRuntimeOptions.dontWarnAboutMultipleDatabases = true; + return Database(moor.VmDatabase.memory()); +} diff --git a/test/fake_database_web.dart b/test/fake_database_web.dart new file mode 100644 index 00000000..d26aed5d --- /dev/null +++ b/test/fake_database_web.dart @@ -0,0 +1,26 @@ +/* + * Famedly Matrix SDK + * Copyright (C) 2019, 2020 Famedly GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:famedlysdk/famedlysdk.dart'; +import 'package:moor/moor.dart'; +import 'package:moor/moor_web.dart' as moor; + +Future getDatabase(Client _) async { + moorRuntimeOptions.dontWarnAboutMultipleDatabases = true; + return Database(moor.WebDatabase('test')); +}