2021-07-17 00:24:17 +00:00
|
|
|
pub mod builder;
|
2021-07-16 15:18:12 +00:00
|
|
|
mod helper;
|
|
|
|
|
2021-09-04 08:12:48 +00:00
|
|
|
use crate::helper::*;
|
2021-08-20 06:38:03 +00:00
|
|
|
use flowy_sdk::FlowySDK;
|
2021-09-04 08:53:58 +00:00
|
|
|
use flowy_user::entities::UserProfile;
|
2021-07-06 06:14:47 +00:00
|
|
|
|
|
|
|
pub mod prelude {
|
2021-09-04 07:12:53 +00:00
|
|
|
pub use crate::{builder::*, helper::*, *};
|
2021-07-08 13:23:44 +00:00
|
|
|
pub use flowy_dispatch::prelude::*;
|
2021-07-06 06:14:47 +00:00
|
|
|
}
|
|
|
|
|
2021-09-04 07:12:53 +00:00
|
|
|
pub type FlowyTestSDK = FlowySDK;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2021-09-04 08:12:48 +00:00
|
|
|
pub struct FlowyEnv {
|
|
|
|
pub sdk: FlowyTestSDK,
|
2021-09-04 08:53:58 +00:00
|
|
|
pub user: UserProfile,
|
2021-09-04 08:12:48 +00:00
|
|
|
pub password: String,
|
2021-09-04 07:12:53 +00:00
|
|
|
}
|
|
|
|
|
2021-09-04 08:12:48 +00:00
|
|
|
impl FlowyEnv {
|
|
|
|
pub fn setup() -> Self {
|
|
|
|
let sdk = init_test_sdk();
|
|
|
|
let result = sign_up(sdk.dispatch());
|
|
|
|
let env = Self {
|
|
|
|
sdk,
|
2021-09-04 08:53:58 +00:00
|
|
|
user: result.user_profile,
|
2021-09-04 08:12:48 +00:00
|
|
|
password: result.password,
|
|
|
|
};
|
|
|
|
env
|
2021-09-04 07:12:53 +00:00
|
|
|
}
|
|
|
|
|
2021-09-04 08:12:48 +00:00
|
|
|
pub fn sdk(&self) -> FlowyTestSDK { self.sdk.clone() }
|
2021-09-04 07:12:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn init_test_sdk() -> FlowyTestSDK {
|
|
|
|
let root_dir = root_dir();
|
|
|
|
FlowySDK::new(&root_dir)
|
2021-07-06 06:14:47 +00:00
|
|
|
}
|