Increase timeout for fs-dependent conditions
This commit is contained in:
@@ -3152,7 +3152,7 @@ mod tests {
|
||||
|
||||
fs::remove_file(dir.path().join("file2")).unwrap();
|
||||
buffer2
|
||||
.condition(&app, |buffer2, _| buffer2.is_dirty())
|
||||
.condition_with_duration(Duration::from_millis(500), &app, |b, _| b.is_dirty())
|
||||
.await;
|
||||
assert_eq!(
|
||||
*events.borrow(),
|
||||
@@ -3178,7 +3178,9 @@ mod tests {
|
||||
events.borrow_mut().clear();
|
||||
fs::remove_file(dir.path().join("file3")).unwrap();
|
||||
buffer3
|
||||
.condition(&app, |_, _| !events.borrow().is_empty())
|
||||
.condition_with_duration(Duration::from_millis(500), &app, |_, _| {
|
||||
!events.borrow().is_empty()
|
||||
})
|
||||
.await;
|
||||
assert_eq!(*events.borrow(), &[Event::FileHandleChanged]);
|
||||
app.read(|ctx| assert!(buffer3.read(ctx).is_dirty()));
|
||||
|
||||
+10
-4
@@ -759,7 +759,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::{editor::BufferView, settings, test::temp_tree};
|
||||
use serde_json::json;
|
||||
use std::{collections::HashSet, fs};
|
||||
use std::{collections::HashSet, fs, time::Duration};
|
||||
use tempdir::TempDir;
|
||||
|
||||
#[gpui::test]
|
||||
@@ -1031,14 +1031,18 @@ mod tests {
|
||||
app.update(|ctx| editor.update(ctx, |editor, ctx| editor.insert(&"x".to_string(), ctx)));
|
||||
fs::write(dir.path().join("a.txt"), "changed").unwrap();
|
||||
editor
|
||||
.condition(&app, |editor, ctx| editor.has_conflict(ctx))
|
||||
.condition_with_duration(Duration::from_millis(500), &app, |editor, ctx| {
|
||||
editor.has_conflict(ctx)
|
||||
})
|
||||
.await;
|
||||
app.read(|ctx| assert!(editor.is_dirty(ctx)));
|
||||
|
||||
app.update(|ctx| workspace.update(ctx, |w, ctx| w.save_active_item(&(), ctx)));
|
||||
app.simulate_prompt_answer(window_id, 0);
|
||||
editor
|
||||
.condition(&app, |editor, ctx| !editor.is_dirty(ctx))
|
||||
.condition_with_duration(Duration::from_millis(500), &app, |editor, ctx| {
|
||||
!editor.is_dirty(ctx)
|
||||
})
|
||||
.await;
|
||||
app.read(|ctx| assert!(!editor.has_conflict(ctx)));
|
||||
}
|
||||
@@ -1095,7 +1099,9 @@ mod tests {
|
||||
|
||||
// When the save completes, the buffer's title is updated.
|
||||
editor
|
||||
.condition(&app, |editor, ctx| !editor.is_dirty(ctx))
|
||||
.condition_with_duration(Duration::from_millis(500), &app, |editor, ctx| {
|
||||
!editor.is_dirty(ctx)
|
||||
})
|
||||
.await;
|
||||
app.read(|ctx| {
|
||||
assert!(!editor.is_dirty(ctx));
|
||||
|
||||
Reference in New Issue
Block a user