2021-07-19 13:05:49 +00:00
|
|
|
use flowy_test::builder::WorkspaceTestBuilder;
|
|
|
|
use flowy_workspace::{
|
|
|
|
entities::{
|
2021-07-19 14:44:37 +00:00
|
|
|
app::{App, CreateAppRequest},
|
2021-07-20 06:03:21 +00:00
|
|
|
workspace::Workspace,
|
2021-07-19 13:05:49 +00:00
|
|
|
},
|
2021-07-20 06:03:21 +00:00
|
|
|
event::WorkspaceEvent::{CreateApp, GetCurWorkspace},
|
2021-07-19 13:05:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn app_create_success() {
|
|
|
|
let user_workspace = WorkspaceTestBuilder::new()
|
2021-07-20 06:03:21 +00:00
|
|
|
.event(GetCurWorkspace)
|
2021-07-19 13:05:49 +00:00
|
|
|
.sync_send()
|
2021-07-20 06:03:21 +00:00
|
|
|
.parse::<Workspace>();
|
2021-07-19 13:05:49 +00:00
|
|
|
|
|
|
|
let request = CreateAppRequest {
|
2021-07-20 06:03:21 +00:00
|
|
|
workspace_id: user_workspace.id,
|
|
|
|
name: "Github".to_owned(),
|
|
|
|
desc: "AppFlowy Github Project".to_owned(),
|
|
|
|
color_style: Default::default(),
|
|
|
|
};
|
|
|
|
|
|
|
|
let app_detail = WorkspaceTestBuilder::new()
|
|
|
|
.event(CreateApp)
|
|
|
|
.request(request)
|
|
|
|
.sync_send()
|
|
|
|
.parse::<App>();
|
|
|
|
|
|
|
|
dbg!(&app_detail);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn app_list_from_cur_workspace_test() {
|
|
|
|
let user_workspace = WorkspaceTestBuilder::new()
|
|
|
|
.event(GetCurWorkspace)
|
|
|
|
.sync_send()
|
|
|
|
.parse::<Workspace>();
|
|
|
|
|
|
|
|
let request = CreateAppRequest {
|
|
|
|
workspace_id: user_workspace.id,
|
2021-07-19 13:05:49 +00:00
|
|
|
name: "Github".to_owned(),
|
|
|
|
desc: "AppFlowy Github Project".to_owned(),
|
|
|
|
color_style: Default::default(),
|
|
|
|
};
|
|
|
|
|
|
|
|
let app_detail = WorkspaceTestBuilder::new()
|
|
|
|
.event(CreateApp)
|
|
|
|
.request(request)
|
|
|
|
.sync_send()
|
2021-07-19 14:44:37 +00:00
|
|
|
.parse::<App>();
|
2021-07-19 13:05:49 +00:00
|
|
|
|
|
|
|
dbg!(&app_detail);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO 1) test update app 2) delete app
|