mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 18:41:10 +00:00
Try clearing Client's state at the ends of integration tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
02ae2d8a4f
commit
3b7cfad718
2 changed files with 15 additions and 0 deletions
|
@ -228,6 +228,15 @@ impl Client {
|
||||||
self.http.clone()
|
self.http.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
|
pub fn tear_down(&self) {
|
||||||
|
let mut state = self.state.write();
|
||||||
|
state.message_handlers.clear();
|
||||||
|
state.models_by_message_type.clear();
|
||||||
|
state.models_by_entity_type_and_remote_id.clear();
|
||||||
|
state.entity_id_extractors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub fn override_authenticate<F>(&mut self, authenticate: F) -> &mut Self
|
pub fn override_authenticate<F>(&mut self, authenticate: F) -> &mut Self
|
||||||
where
|
where
|
||||||
|
|
|
@ -5052,6 +5052,12 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for TestClient {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.client.tear_down();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Executor for Arc<gpui::executor::Background> {
|
impl Executor for Arc<gpui::executor::Background> {
|
||||||
fn spawn_detached<F: 'static + Send + Future<Output = ()>>(&self, future: F) {
|
fn spawn_detached<F: 'static + Send + Future<Output = ()>>(&self, future: F) {
|
||||||
self.spawn(future).detach();
|
self.spawn(future).detach();
|
||||||
|
|
Loading…
Reference in a new issue