workspace_test.rs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. use crate::client_folder::script::FolderNodePadScript::*;
  2. use crate::client_folder::script::FolderNodePadTest;
  3. #[test]
  4. fn client_folder_create_multi_workspaces_test() {
  5. let mut test = FolderNodePadTest::new();
  6. test.run_scripts(vec![
  7. AssertPathOfWorkspace {
  8. id: "1".to_string(),
  9. expected_path: vec![0, 0, 0].into(),
  10. },
  11. CreateWorkspace {
  12. id: "a".to_string(),
  13. name: "workspace a".to_string(),
  14. },
  15. AssertPathOfWorkspace {
  16. id: "a".to_string(),
  17. expected_path: vec![0, 0, 1].into(),
  18. },
  19. CreateWorkspace {
  20. id: "b".to_string(),
  21. name: "workspace b".to_string(),
  22. },
  23. AssertPathOfWorkspace {
  24. id: "b".to_string(),
  25. expected_path: vec![0, 0, 2].into(),
  26. },
  27. AssertNumberOfWorkspace { expected: 3 },
  28. // The path of the workspace 'b' will be changed after deleting the 'a' workspace.
  29. DeleteWorkspace { id: "a".to_string() },
  30. AssertPathOfWorkspace {
  31. id: "b".to_string(),
  32. expected_path: vec![0, 0, 1].into(),
  33. },
  34. ]);
  35. }
  36. #[test]
  37. fn client_folder_create_app_test() {
  38. let mut test = FolderNodePadTest::new();
  39. test.run_scripts(vec![
  40. CreateApp {
  41. id: "1".to_string(),
  42. name: "my first app".to_string(),
  43. },
  44. AssertAppContent {
  45. id: "1".to_string(),
  46. name: "my first app".to_string(),
  47. },
  48. ]);
  49. }
  50. #[test]
  51. fn client_folder_delete_app_test() {
  52. let mut test = FolderNodePadTest::new();
  53. test.run_scripts(vec![
  54. CreateApp {
  55. id: "1".to_string(),
  56. name: "my first app".to_string(),
  57. },
  58. DeleteApp { id: "1".to_string() },
  59. AssertApp {
  60. id: "1".to_string(),
  61. expected: None,
  62. },
  63. ]);
  64. }
  65. #[test]
  66. fn client_folder_update_app_test() {
  67. let mut test = FolderNodePadTest::new();
  68. test.run_scripts(vec![
  69. CreateApp {
  70. id: "1".to_string(),
  71. name: "my first app".to_string(),
  72. },
  73. UpdateApp {
  74. id: "1".to_string(),
  75. name: "TODO".to_string(),
  76. },
  77. AssertAppContent {
  78. id: "1".to_string(),
  79. name: "TODO".to_string(),
  80. },
  81. ]);
  82. }