From f7782252c8e79ea996e5a6ab08aec41391a7954e Mon Sep 17 00:00:00 2001 From: Harold Hunt Date: Sun, 27 Sep 2026 09:52:45 -0400 Subject: [PATCH] test: wait for widening scans to finish before assertions Co-authored-by: Abdulwahab Isam <5349989+ai94iq@users.noreply.github.com> --- crates/disktree-app/src/tests.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/disktree-app/src/tests.rs b/crates/disktree-app/src/tests.rs index 2eb15d2..d443290 100644 --- a/crates/disktree-app/src/tests.rs +++ b/crates/disktree-app/src/tests.rs @@ -1045,11 +1045,15 @@ fn finish_scan(view: &Entity, cx: &mut Window) { let epoch = read(view, cx, |app| app.scan_epoch); for _ in 0..600 { std::thread::sleep(std::time::Duration::from_millis(5)); - let ready = update(view, cx, |app, cx| { - app.poll_scan_once(epoch, cx); - app.tree().is_some() - }); - if ready { + // Widening keeps the old tree visible while the new scan runs. + // Its presence does not mean the requested scan has completed. + let running = update(view, cx, |app, cx| app.poll_scan_once(epoch, cx)); + if !running { + assert!( + read(view, cx, |app| app.scan_error.is_none()), + "the scan failed" + ); + assert!(read(view, cx, |app| app.tree().is_some())); return; } }