Add SystemClock
(#8239)
This PR adds a `SystemClock` trait for abstracting away the system clock. This allows us to swap out the real system clock with a `FakeSystemClock` in the tests, thus allowing the fake passage of time. We're using this in `Telemetry` to better mock the clock for testing purposes. Release Notes: - N/A
This commit is contained in:
parent
cc8e3c2286
commit
0de8672044
16 changed files with 213 additions and 55 deletions
|
@ -25,6 +25,7 @@ async-recursion = "1.0.0"
|
|||
bincode = "1.2.1"
|
||||
call.workspace = true
|
||||
client.workspace = true
|
||||
clock.workspace = true
|
||||
collections.workspace = true
|
||||
db.workspace = true
|
||||
derive_more.workspace = true
|
||||
|
|
|
@ -397,8 +397,9 @@ impl AppState {
|
|||
|
||||
let fs = fs::FakeFs::new(cx.background_executor().clone());
|
||||
let languages = Arc::new(LanguageRegistry::test());
|
||||
let clock = Arc::new(clock::FakeSystemClock::default());
|
||||
let http_client = util::http::FakeHttpClient::with_404_response();
|
||||
let client = Client::new(http_client.clone(), cx);
|
||||
let client = Client::new(clock, http_client.clone(), cx);
|
||||
let user_store = cx.new_model(|cx| UserStore::new(client.clone(), cx));
|
||||
let workspace_store = cx.new_model(|cx| WorkspaceStore::new(client.clone(), cx));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue