chore: clean up unused imports in tests

This commit is contained in:
Greg Johnston 2024-07-31 12:45:55 -04:00
parent 9330cf23b1
commit 27f2e60d16
2 changed files with 46 additions and 15 deletions

View file

@ -1,18 +1,23 @@
use any_spawner::Executor;
use reactive_graph::{
effect::{Effect, RenderEffect},
prelude::*,
signal::RwSignal,
};
use std::{
mem,
sync::{Arc, RwLock},
};
use tokio::task;
#[cfg(feature = "effects")]
pub mod imports {
pub use any_spawner::Executor;
pub use reactive_graph::{
effect::{Effect, RenderEffect},
prelude::*,
signal::RwSignal,
};
pub use std::{
mem,
sync::{Arc, RwLock},
};
pub use tokio::task;
}
#[cfg(feature = "effects")]
#[tokio::test]
async fn render_effect_runs() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()
.run_until(async {
@ -46,6 +51,8 @@ async fn render_effect_runs() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn effect_runs() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()
@ -78,6 +85,8 @@ async fn effect_runs() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn dynamic_dependencies() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()

View file

@ -1,17 +1,31 @@
use any_spawner::Executor;
use reactive_graph::{
computed::{ArcMemo, Memo},
effect::{Effect, RenderEffect},
prelude::*,
signal::RwSignal,
wrappers::read::Signal,
};
use std::{
mem,
rc::Rc,
sync::{Arc, RwLock},
};
use tokio::task;
#[cfg(feature = "effects")]
pub mod imports {
pub use any_spawner::Executor;
pub use reactive_graph::{
computed::{ArcMemo, Memo},
effect::{Effect, RenderEffect},
prelude::*,
signal::RwSignal,
wrappers::read::Signal,
};
pub use std::{
mem,
rc::Rc,
sync::{Arc, RwLock},
};
pub use tokio::task;
}
#[test]
fn memo_calculates_value() {
@ -173,6 +187,8 @@ fn diamond_problem() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn dynamic_dependencies() {
use imports::*;
_ = Executor::init_tokio();
let first = RwSignal::new("Greg");
@ -248,6 +264,8 @@ async fn dynamic_dependencies() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn render_effect_doesnt_rerun_if_memo_didnt_change() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()
@ -289,6 +307,8 @@ async fn render_effect_doesnt_rerun_if_memo_didnt_change() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn effect_doesnt_rerun_if_memo_didnt_change() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()
@ -323,6 +343,8 @@ async fn effect_doesnt_rerun_if_memo_didnt_change() {
#[cfg(feature = "effects")]
#[tokio::test]
async fn effect_depending_on_signal_and_memo_doesnt_rerun_unnecessarily() {
use imports::*;
_ = Executor::init_tokio();
task::LocalSet::new()