fix(test): de-flake theme_persistence project-write assertion under load

The "persists project.theme into that repo" case asserted the .clide
settings file existed after a single pumpEventQueue, but the write is
fire-and-forget real I/O — one event-queue drain doesn't guarantee the disk
flush, so it flaked in the loaded coverage pool. Poll for the file (bounded)
instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 22:30:47 +02:00
co-authored by Claude Opus 4.8
parent 18c8e702fb
commit 160cc81741
+7 -2
View File
@@ -61,8 +61,13 @@ void main() {
await settings.setProjectDir(repoTmp);
theme.select('forest');
expect(settings.get<String>('project.theme'), 'forest');
await pumpEventQueue(); // let the unawaited file write flush
expect(await File('${repoTmp.path}/.clide/settings.yaml').exists(), isTrue);
// The on-disk write is fire-and-forget; poll for it instead of assuming a
// single event-queue drain flushes the real I/O (flaked under load).
final file = File('${repoTmp.path}/.clide/settings.yaml');
for (var i = 0; i < 100 && !file.existsSync(); i++) {
await Future<void>.delayed(const Duration(milliseconds: 5));
}
expect(file.existsSync(), isTrue);
});
test('the high-contrast variant persists (the name encodes -hc)', () async {