Skip to content

Commit cc39836

Browse files
fix(test): skip legacy profile migration during flutter test runs
Prevent unit tests from copying the developer's com.example profile into temp dirs, which broke isolated AppSettings expectations.
1 parent 6f05015 commit cc39836

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎lib/core/storage/app_data_root.dart‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ abstract final class AppDataRoot {
142142

143143
@visibleForTesting
144144
static Future<List<Directory>> legacySupportCandidates() async {
145+
if (Platform.environment.containsKey('FLUTTER_TEST')) {
146+
return mockLegacySupportCandidates ?? const [];
147+
}
148+
145149
final home = _env['HOME'] ?? _env['USERPROFILE'];
146150
if (home == null || home.isEmpty) return const [];
147151

‎test/flutter_test_config.dart‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22

3+
import 'package:querya_desktop/core/storage/app_data_root.dart';
34
import 'package:querya_desktop/core/storage/connection_secrets_store.dart';
45

56
import 'memory_secrets_backend.dart';
@@ -8,5 +9,8 @@ import 'memory_secrets_backend.dart';
89
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
910
ConnectionSecretsStore.backend = testMemorySecrets;
1011
testMemorySecrets.clear();
12+
// Avoid copying the developer's real legacy profile into test temp dirs.
13+
AppDataRoot.mockLegacySupportCandidates = const [];
1114
await testMain();
15+
AppDataRoot.resetMocks();
1216
}

0 commit comments

Comments
 (0)