mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
test: EventTracker::get_matching_opt: Return the first matching event, not last
This commit is contained in:
@@ -1469,7 +1469,7 @@ impl EventTracker {
|
|||||||
.expect("timeout waiting for event match")
|
.expect("timeout waiting for event match")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Consumes emitted events returning the first matching one if any.
|
/// Consumes all emitted events returning the first matching one if any.
|
||||||
pub async fn get_matching_opt<F: Fn(&EventType) -> bool>(
|
pub async fn get_matching_opt<F: Fn(&EventType) -> bool>(
|
||||||
&self,
|
&self,
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
@@ -1483,7 +1483,7 @@ impl EventTracker {
|
|||||||
return found_event;
|
return found_event;
|
||||||
}
|
}
|
||||||
if event_matcher(&event.typ) {
|
if event_matcher(&event.typ) {
|
||||||
found_event = Some(event.typ);
|
found_event.get_or_insert(event.typ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user