2022-12-02 22:31:03 +08:00
|
|
|
use crate::client_folder::script::FolderNodePadScript::*;
|
|
|
|
use crate::client_folder::script::FolderNodePadTest;
|
2022-12-04 15:23:24 +08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn client_folder_create_multi_workspaces_test() {
|
2023-02-13 09:29:49 +08:00
|
|
|
let mut test = FolderNodePadTest::new();
|
|
|
|
test.run_scripts(vec![
|
|
|
|
AssertPathOfWorkspace {
|
|
|
|
id: "1".to_string(),
|
|
|
|
expected_path: vec![0, 0, 0].into(),
|
|
|
|
},
|
|
|
|
CreateWorkspace {
|
|
|
|
id: "a".to_string(),
|
|
|
|
name: "workspace a".to_string(),
|
|
|
|
},
|
|
|
|
AssertPathOfWorkspace {
|
|
|
|
id: "a".to_string(),
|
|
|
|
expected_path: vec![0, 0, 1].into(),
|
|
|
|
},
|
|
|
|
CreateWorkspace {
|
|
|
|
id: "b".to_string(),
|
|
|
|
name: "workspace b".to_string(),
|
|
|
|
},
|
|
|
|
AssertPathOfWorkspace {
|
|
|
|
id: "b".to_string(),
|
|
|
|
expected_path: vec![0, 0, 2].into(),
|
|
|
|
},
|
|
|
|
AssertNumberOfWorkspace { expected: 3 },
|
|
|
|
// The path of the workspace 'b' will be changed after deleting the 'a' workspace.
|
|
|
|
DeleteWorkspace {
|
|
|
|
id: "a".to_string(),
|
|
|
|
},
|
|
|
|
AssertPathOfWorkspace {
|
|
|
|
id: "b".to_string(),
|
|
|
|
expected_path: vec![0, 0, 1].into(),
|
|
|
|
},
|
|
|
|
]);
|
2022-12-04 15:23:24 +08:00
|
|
|
}
|
2022-12-02 22:31:03 +08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn client_folder_create_app_test() {
|
2023-02-13 09:29:49 +08:00
|
|
|
let mut test = FolderNodePadTest::new();
|
|
|
|
test.run_scripts(vec![
|
|
|
|
CreateApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "my first app".to_string(),
|
|
|
|
},
|
|
|
|
AssertAppContent {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "my first app".to_string(),
|
|
|
|
},
|
|
|
|
]);
|
2022-12-02 22:31:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn client_folder_delete_app_test() {
|
2023-02-13 09:29:49 +08:00
|
|
|
let mut test = FolderNodePadTest::new();
|
|
|
|
test.run_scripts(vec![
|
|
|
|
CreateApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "my first app".to_string(),
|
|
|
|
},
|
|
|
|
DeleteApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
},
|
|
|
|
AssertApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
expected: None,
|
|
|
|
},
|
|
|
|
]);
|
2022-12-02 22:31:03 +08:00
|
|
|
}
|
2022-12-03 12:03:52 +08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn client_folder_update_app_test() {
|
2023-02-13 09:29:49 +08:00
|
|
|
let mut test = FolderNodePadTest::new();
|
|
|
|
test.run_scripts(vec![
|
|
|
|
CreateApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "my first app".to_string(),
|
|
|
|
},
|
|
|
|
UpdateApp {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "TODO".to_string(),
|
|
|
|
},
|
|
|
|
AssertAppContent {
|
|
|
|
id: "1".to_string(),
|
|
|
|
name: "TODO".to_string(),
|
|
|
|
},
|
|
|
|
]);
|
2022-12-03 12:03:52 +08:00
|
|
|
}
|