Ensure the SettingsStore global is added in tests

This commit is contained in:
Max Brunsfeld 2023-05-10 16:39:59 -07:00
parent 68867fe2e1
commit cee7edabf9
10 changed files with 61 additions and 32 deletions

View file

@ -19,7 +19,7 @@ use gpui::{
use language::LanguageRegistry;
use parking_lot::Mutex;
use project::{Project, WorktreeId};
use settings::Settings;
use settings::{Settings, SettingsStore};
use std::{
cell::{Ref, RefCell, RefMut},
env,
@ -102,6 +102,7 @@ impl TestServer {
async fn create_client(&mut self, cx: &mut TestAppContext, name: &str) -> TestClient {
cx.update(|cx| {
cx.set_global(SettingsStore::test(cx));
cx.set_global(Settings::test(cx));
});
@ -185,6 +186,8 @@ impl TestServer {
})
});
cx.update(|cx| client::init(&client, cx));
let fs = FakeFs::new(cx.background());
let user_store = cx.add_model(|cx| UserStore::new(client.clone(), http, cx));
let app_state = Arc::new(workspace::AppState {

View file

@ -20,7 +20,7 @@ use rand::{
prelude::*,
};
use serde::{Deserialize, Serialize};
use settings::Settings;
use settings::{Settings, SettingsStore};
use std::{
env,
ops::Range,
@ -148,8 +148,11 @@ async fn test_random_collaboration(
for (client, mut cx) in clients {
cx.update(|cx| {
let store = cx.remove_global::<SettingsStore>();
let settings = cx.remove_global::<Settings>();
cx.clear_globals();
cx.set_global(Settings::test(cx));
cx.set_global(store);
cx.set_global(settings);
drop(client);
});
}