Skip to content

Commit 123ed3a

Browse files
committed
cleanup
1 parent 8093c7f commit 123ed3a

File tree

11 files changed

+23
-52
lines changed

11 files changed

+23
-52
lines changed

macros/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub fn zwang_url(input: TokenStream) -> TokenStream {
2727
macros_impl::zwang_url(input).into()
2828
}
2929

30-
/// NOTE: Should probably name this "leptos test setup".
3130
#[proc_macro_attribute]
32-
pub fn tracing_to_console_log(_: TokenStream, input: TokenStream) -> TokenStream {
33-
macros_impl::tracing_to_console_log::tracing_to_console_log(input)
31+
pub fn leptos_test_setup(_: TokenStream, input: TokenStream) -> TokenStream {
32+
macros_impl::leptos_test_setup::leptos_test_setup(input)
3433
}

macros_impl/src/tracing_to_console_log.rs renamed to macros_impl/src/leptos_test_setup.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use quote::quote;
33
use syn::{parse_macro_input, ItemFn};
44

55
/// NOTE: Should probably name this "leptos test setup"
6-
pub fn tracing_to_console_log(item: TokenStream) -> TokenStream {
6+
pub fn leptos_test_setup(item: TokenStream) -> TokenStream {
77
let input = parse_macro_input!(item as ItemFn);
88

99
let fn_vis = &input.vis;
@@ -14,11 +14,12 @@ pub fn tracing_to_console_log(item: TokenStream) -> TokenStream {
1414
let output = &input.sig.output;
1515

1616
let expanded = quote! {
17+
#[::wasm_bindgen_test::wasm_bindgen_test]
1718
#fn_vis #asyncness fn #fn_name(#input_args) #output {
1819
{
1920
_ = ::leptos::task::Executor::init_wasm_bindgen();
2021
let buffer = ::std::sync::Arc::new(::std::sync::Mutex::new(Vec::new()));
21-
let writer_factory = ::wasm_testing_utils::tracing_to_console_log::MemoryWriterFactory {
22+
let writer_factory = ::wasm_testing_utils::leptos_test_setup::MemoryWriterFactory {
2223
buffer: ::std::sync::Arc::clone(&buffer),
2324
};
2425
let subscriber = ::tracing_subscriber::fmt()

macros_impl/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate proc_macro;
66
mod avail_merge;
77
mod zwang_router;
88
mod typesafe_idb;
9-
pub mod tracing_to_console_log;
9+
pub mod leptos_test_setup;
1010

1111
pub use avail_merge::derive_avail_merge;
1212
pub use typesafe_idb::derive_typesafe_idb;

shared/src/sync_engine/new_defn.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ impl<BackendApi: BackendApiTrait, Transport: TransportTrait, GithubApi>
7979
orig_trackers
8080
.iter()
8181
.filter(|sub| {
82-
tracing::trace!(
83-
"Checking if orig {:#?} is affected by writes in {:#?}",
84-
sub.original_reactivity_trackers,
85-
reactivity_trackers
86-
);
8782
sub.original_reactivity_trackers
8883
.is_affected_by_writes_in(reactivity_trackers)
8984
})

shared/src/sync_engine/optimistic/db/object_store.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ where
193193
self.optimistic_changes.update(row, update_fut);
194194

195195
if let Some(commit_listener) = self.commit_listener.as_ref() {
196-
tracing::trace!(
197-
"invoked commit_listener() from within ObjectStore::update() with reactivity trackers: {:?}",
198-
reactivity_trackers
199-
);
200196
commit_listener(&reactivity_trackers);
201197
}
202198
}
@@ -209,10 +205,6 @@ where
209205
self.optimistic_changes.create(row, create_fut);
210206

211207
if let Some(commit_listener) = self.commit_listener.as_ref() {
212-
tracing::trace!(
213-
"invoked commit_listener() from within ObjectStore::create() with reactivity trackers: {:?}",
214-
reactivity_trackers
215-
);
216208
commit_listener(&reactivity_trackers);
217209
}
218210
}

shared/src/sync_engine/optimistic/db/tests.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use std::{cell::RefCell, rc::Rc, sync::Arc};
22

33
use bon::builder;
4-
use macros::tracing_to_console_log;
4+
use macros::leptos_test_setup;
55
use typesafe_idb::{ReadOnly, ReadWrite};
66
use url::Url;
7-
use wasm_bindgen_test::wasm_bindgen_test;
87

98
use crate::{
109
backend_api_trait::BackendApi,
@@ -78,8 +77,7 @@ async fn num_times_subscriber_called<Txn1Markers, Txn1Mode, Txn2Markers, Txn2Mod
7877
}
7978
}
8079

81-
#[wasm_bindgen_test]
82-
#[tracing_to_console_log]
80+
#[leptos_test_setup]
8381
pub async fn index_get_no_optimisim_put_overlapping() {
8482
num_times_subscriber_called()
8583
.make_txn_1(|txn| txn.with_store::<Issue>().build())
@@ -105,8 +103,7 @@ pub async fn index_get_no_optimisim_put_overlapping() {
105103
.await;
106104
}
107105

108-
#[wasm_bindgen_test]
109-
#[tracing_to_console_log]
106+
#[leptos_test_setup]
110107
pub async fn index_get_no_optimisim_put_non_overlapping() {
111108
num_times_subscriber_called()
112109
.make_txn_1(|txn| txn.with_store::<Issue>().build())
@@ -132,8 +129,7 @@ pub async fn index_get_no_optimisim_put_non_overlapping() {
132129
.await;
133130
}
134131

135-
#[wasm_bindgen_test]
136-
#[tracing_to_console_log]
132+
#[leptos_test_setup]
137133
pub async fn get_no_optimisim_put_overlapping() {
138134
let some_issue_id = 4.into();
139135
num_times_subscriber_called()
@@ -161,8 +157,7 @@ pub async fn get_no_optimisim_put_overlapping() {
161157
.await;
162158
}
163159

164-
#[wasm_bindgen_test]
165-
#[tracing_to_console_log]
160+
#[leptos_test_setup]
166161
pub async fn get_no_optimisim_put_non_overlapping() {
167162
let some_issue_id = 4.into();
168163
num_times_subscriber_called()
@@ -211,8 +206,7 @@ pub async fn get_no_optimisim_put_non_overlapping() {
211206
.await;
212207
}
213208

214-
#[wasm_bindgen_test]
215-
#[tracing_to_console_log]
209+
#[leptos_test_setup]
216210
pub async fn get_all_no_optimisim_put_overlapping() {
217211
num_times_subscriber_called()
218212
.make_txn_1(|txn| txn.with_store::<Issue>().build())
@@ -232,8 +226,7 @@ pub async fn get_all_no_optimisim_put_overlapping() {
232226
.await;
233227
}
234228

235-
#[wasm_bindgen_test]
236-
#[tracing_to_console_log]
229+
#[leptos_test_setup]
237230
pub async fn get_all_no_optimisim_put_non_overlapping() {
238231
num_times_subscriber_called()
239232
.make_txn_1(|txn| txn.with_store::<Issue>().build())
@@ -257,8 +250,7 @@ pub async fn get_all_no_optimisim_put_non_overlapping() {
257250
.await;
258251
}
259252

260-
#[wasm_bindgen_test]
261-
#[tracing_to_console_log]
253+
#[leptos_test_setup]
262254
pub async fn get_all_no_optimisim_create_overlapping() {
263255
num_times_subscriber_called()
264256
.make_txn_1(|txn| txn.with_store::<Issue>().build())
@@ -276,8 +268,7 @@ pub async fn get_all_no_optimisim_create_overlapping() {
276268
.await;
277269
}
278270

279-
#[wasm_bindgen_test]
280-
#[tracing_to_console_log]
271+
#[leptos_test_setup]
281272
pub async fn get_all_no_optimisim_create_non_overlapping() {
282273
num_times_subscriber_called()
283274
.make_txn_1(|txn| txn.with_store::<Issue>().build())

shared/src/sync_engine/tests.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
use any_spawner::Executor;
22
use futures::SinkExt;
33
use github_api::models::{IssuesCreateRequest, IssuesCreateRequestTitle};
4-
use github_webhook_body::{
5-
Issues, IssuesOpenedChanges, IssuesOpenedIssue, SomethingWithAnId, WebhookBody,
6-
};
4+
use github_webhook_body::{Issues, IssuesOpenedIssue, SomethingWithAnId, WebhookBody};
75
use jiff::Timestamp;
86
use leptos::task::tick;
9-
use macros::tracing_to_console_log;
7+
use macros::leptos_test_setup;
108
use maplit::{hashmap, hashset};
119
use mockall::predicate;
1210
use std::{
@@ -37,11 +35,13 @@ use super::{
3735
DbSubscription, SyncEngine,
3836
};
3937

38+
#[allow(dead_code)]
4039
#[derive(Clone, Default, Debug)]
4140
struct NumTimesHit {
4241
hit: Arc<AtomicUsize>,
4342
}
4443

44+
#[allow(dead_code)]
4545
impl NumTimesHit {
4646
pub fn increment(&self) {
4747
self.hit.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
@@ -59,8 +59,7 @@ impl NumTimesHit {
5959
}
6060
}
6161

62-
#[wasm_bindgen_test::wasm_bindgen_test]
63-
#[tracing_to_console_log]
62+
#[leptos_test_setup]
6463
async fn testing_optimistic_create() {
6564
let user = User::default();
6665
let repository = Repository::default();
@@ -200,7 +199,6 @@ async fn testing_optimistic_create() {
200199
wait_for(move || create_issues_hit.expect_and_reset(1)).await;
201200
assert!(bulk_subscriber_hit.expect_and_reset(0));
202201

203-
204202
let txn = sync_engine.db.txn().with_store::<Issue>().build();
205203
let single_issue = txn
206204
.object_store::<Issue>()

wasm_testing_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub mod tracing_to_console_log;
1+
pub mod leptos_test_setup;

web/src/app/auth.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use shared::{
33
backend_api_trait::BackendApiTrait,
44
endpoints::{
55
defns::api::{
6-
app_installs::create::{
7-
CreateAppInstallEndpoint, CreateAppInstallPayload, CreateAppInstallResponse,
8-
},
6+
app_installs::create::{CreateAppInstallPayload, CreateAppInstallResponse},
97
auth::finish::GithubAccessToken,
108
},
119
endpoint_client::OwnApiError,
@@ -19,9 +17,7 @@ use leptos::{
1917
prelude::*,
2018
task::{spawn_local, spawn_local_scoped},
2119
};
22-
use shared::endpoints::defns::api::auth::finish::{
23-
AuthFinishEndpoint, AuthFinishPayload, AuthFinishResponse,
24-
};
20+
use shared::endpoints::defns::api::auth::finish::{AuthFinishPayload, AuthFinishResponse};
2521
use wasm_bindgen_futures::JsFuture;
2622

2723
use crate::{

0 commit comments

Comments
 (0)