From 9aab6741d19f9e73efeff05349e1cb1d0bc77fa7 Mon Sep 17 00:00:00 2001 From: Matthias Nehlsen Date: Mon, 9 Dec 2024 01:05:25 +0100 Subject: [PATCH] test: use in-memory databases in matrix test --- integration_test/matrix_service_test.dart | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/integration_test/matrix_service_test.dart b/integration_test/matrix_service_test.dart index 359aa8303..ad0d124ea 100644 --- a/integration_test/matrix_service_test.dart +++ b/integration_test/matrix_service_test.dart @@ -57,8 +57,14 @@ void main() { ..registerSingleton(mockUpdateNotifications) ..registerSingleton(UserActivityService()); - final aliceDb = JournalDb(overriddenFilename: 'alice_db.sqlite'); - final bobDb = JournalDb(overriddenFilename: 'bob_db.sqlite'); + final aliceDb = JournalDb( + overriddenFilename: 'alice_db.sqlite', + inMemoryDatabase: true, + ); + final bobDb = JournalDb( + overriddenFilename: 'bob_db.sqlite', + inMemoryDatabase: true, + ); const testSlowNetwork = bool.fromEnvironment(testSlowNetworkEnv); @@ -115,7 +121,7 @@ void main() { ..registerSingleton(docDir) ..registerSingleton(LoggingDb(inMemoryDatabase: true)) ..registerSingleton(JournalDb(inMemoryDatabase: true)) - ..registerSingleton(mockSettingsDb) + ..registerSingleton(SettingsDb(inMemoryDatabase: true)) ..registerSingleton(secureStorageMock); when(() => mockSettingsDb.itemByKey(any())).thenAnswer((_) async => null); @@ -319,7 +325,10 @@ void main() { } await waitUntilAsync( - () async => await aliceDb.getJournalCount() == n, + () async { + final currentCount = await aliceDb.getJournalCount(); + return currentCount == n; + }, ); debugPrint('\n--- Alice finished receiving messages'); final aliceEntriesCount = await aliceDb.getJournalCount();