Skip to content

Commit

Permalink
test: use in-memory databases in matrix test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Dec 9, 2024
1 parent 336867f commit 9aab674
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions integration_test/matrix_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ void main() {
..registerSingleton<UpdateNotifications>(mockUpdateNotifications)
..registerSingleton<UserActivityService>(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);

Expand Down Expand Up @@ -115,7 +121,7 @@ void main() {
..registerSingleton<Directory>(docDir)
..registerSingleton<LoggingDb>(LoggingDb(inMemoryDatabase: true))
..registerSingleton<JournalDb>(JournalDb(inMemoryDatabase: true))
..registerSingleton<SettingsDb>(mockSettingsDb)
..registerSingleton<SettingsDb>(SettingsDb(inMemoryDatabase: true))
..registerSingleton<SecureStorage>(secureStorageMock);

when(() => mockSettingsDb.itemByKey(any())).thenAnswer((_) async => null);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 9aab674

Please sign in to comment.