workspace_test.rs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 {
  30. id: "a".to_string(),
  31. },
  32. AssertPathOfWorkspace {
  33. id: "b".to_string(),
  34. expected_path: vec![0, 0, 1].into(),
  35. },
  36. ]);
  37. }
  38. #[test]
  39. fn client_folder_create_app_test() {
  40. let mut test = FolderNodePadTest::new();
  41. test.run_scripts(vec![
  42. CreateApp {
  43. id: "1".to_string(),
  44. name: "my first app".to_string(),
  45. },
  46. AssertAppContent {
  47. id: "1".to_string(),
  48. name: "my first app".to_string(),
  49. },
  50. ]);
  51. }
  52. #[test]
  53. fn client_folder_delete_app_test() {
  54. let mut test = FolderNodePadTest::new();
  55. test.run_scripts(vec![
  56. CreateApp {
  57. id: "1".to_string(),
  58. name: "my first app".to_string(),
  59. },
  60. DeleteApp {
  61. id: "1".to_string(),
  62. },
  63. AssertApp {
  64. id: "1".to_string(),
  65. expected: None,
  66. },
  67. ]);
  68. }
  69. #[test]
  70. fn client_folder_update_app_test() {
  71. let mut test = FolderNodePadTest::new();
  72. test.run_scripts(vec![
  73. CreateApp {
  74. id: "1".to_string(),
  75. name: "my first app".to_string(),
  76. },
  77. UpdateApp {
  78. id: "1".to_string(),
  79. name: "TODO".to_string(),
  80. },
  81. AssertAppContent {
  82. id: "1".to_string(),
  83. name: "TODO".to_string(),
  84. },
  85. ]);
  86. }