@finos/legend-application-studio 27.1.0 → 27.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +1 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/FunctionEditor.js +28 -24
  7. package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/connection-editor/{DatabaseBuilder.d.ts → DatabaseBuilderWizard.d.ts} +4 -11
  9. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -0
  10. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +48 -0
  11. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -0
  12. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts +32 -0
  13. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts.map +1 -0
  14. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js +99 -0
  15. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js.map +1 -0
  16. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +1 -1
  17. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  18. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
  19. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js +5 -4
  20. package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js.map +1 -1
  21. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
  22. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +62 -12
  23. package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
  24. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts +1 -1
  25. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
  26. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +101 -137
  27. package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
  28. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +11 -0
  29. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
  30. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +27 -2
  31. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
  32. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts +0 -7
  33. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  34. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +20 -77
  35. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  36. package/lib/components/editor/side-bar/Explorer.js +3 -3
  37. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  38. package/lib/components/editor/side-bar/WorkflowManager.d.ts.map +1 -1
  39. package/lib/components/editor/side-bar/WorkflowManager.js +6 -1
  40. package/lib/components/editor/side-bar/WorkflowManager.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +3 -3
  44. package/lib/stores/editor/ExplorerTreeState.d.ts +4 -4
  45. package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
  46. package/lib/stores/editor/ExplorerTreeState.js +4 -4
  47. package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
  48. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  49. package/lib/stores/editor/NewElementState.js.map +1 -1
  50. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +12 -12
  51. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  52. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +45 -46
  53. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +20 -29
  55. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +60 -141
  57. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  58. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts +33 -0
  59. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -0
  60. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +71 -0
  61. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -0
  62. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts +2 -2
  63. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js +2 -2
  65. package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts +14 -19
  67. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts.map +1 -1
  68. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js +30 -65
  69. package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js.map +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +56 -78
  71. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  72. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +285 -384
  73. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  74. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +23 -0
  75. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -0
  76. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +129 -0
  77. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -0
  78. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  79. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +2 -2
  80. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  81. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -0
  82. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  83. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +12 -2
  84. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  85. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
  86. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js +15 -8
  87. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
  88. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts +7 -4
  89. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts.map +1 -1
  90. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js +53 -10
  91. package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map +1 -1
  92. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +2 -1
  93. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
  94. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +20 -16
  95. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
  96. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +3 -48
  97. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -1
  98. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +12 -350
  99. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -1
  100. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts +5 -0
  101. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts.map +1 -1
  102. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js +26 -0
  103. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js.map +1 -1
  104. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -1
  105. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
  106. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +3 -0
  107. package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
  108. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  109. package/lib/stores/editor/utils/MockDataUtils.js +3 -0
  110. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  111. package/lib/stores/editor/utils/TestableUtils.d.ts +11 -1
  112. package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
  113. package/lib/stores/editor/utils/TestableUtils.js +50 -1
  114. package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
  115. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -4
  116. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
  117. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js +4 -1
  118. package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
  119. package/package.json +9 -9
  120. package/src/__lib__/LegendStudioEvent.ts +1 -1
  121. package/src/components/editor/editor-group/FunctionEditor.tsx +133 -118
  122. package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +191 -0
  123. package/src/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.tsx +227 -0
  124. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +1 -1
  125. package/src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx +34 -37
  126. package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +134 -31
  127. package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +296 -414
  128. package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +88 -3
  129. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +47 -211
  130. package/src/components/editor/side-bar/Explorer.tsx +3 -3
  131. package/src/components/editor/side-bar/WorkflowManager.tsx +10 -0
  132. package/src/stores/editor/ExplorerTreeState.ts +6 -9
  133. package/src/stores/editor/NewElementState.ts +0 -1
  134. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +44 -50
  135. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +88 -212
  136. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +102 -0
  137. package/src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts +7 -1
  138. package/src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts +48 -77
  139. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +407 -617
  140. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +243 -0
  141. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
  142. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +18 -1
  143. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +20 -12
  144. package/src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts +76 -18
  145. package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +29 -24
  146. package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +13 -533
  147. package/src/stores/editor/sidebar-state/WorkflowManagerState.ts +47 -0
  148. package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +4 -1
  149. package/src/stores/editor/utils/MockDataUtils.ts +2 -0
  150. package/src/stores/editor/utils/TestableUtils.ts +73 -0
  151. package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +15 -12
  152. package/tsconfig.json +4 -1
  153. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +0 -1
  154. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +0 -133
  155. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +0 -1
  156. package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +0 -397
@@ -23,11 +23,11 @@ import {
23
23
  ModelStore,
24
24
  Database,
25
25
  getMappingCompatibleClasses,
26
- getRootSetImplementation,
27
- RelationalInstanceSetImplementation,
28
- EmbeddedRelationalInstanceSetImplementation,
29
26
  isStubbed_RawLambda,
30
27
  stub_RawLambda,
28
+ MappingTest,
29
+ PackageableElementExplicitReference,
30
+ DataElementReference,
31
31
  } from '@finos/legend-graph';
32
32
  import { forwardRef, useEffect, useRef, useState } from 'react';
33
33
  import {
@@ -55,36 +55,31 @@ import {
55
55
  ResizablePanelSplitterLine,
56
56
  RunAllIcon,
57
57
  RunErrorsIcon,
58
- TestTubeIcon,
59
58
  type SelectComponent,
60
- CheckCircleIcon,
61
- TimesCircleIcon,
62
59
  PanelLoadingIndicator,
63
60
  ContextMenu,
64
61
  ModalHeader,
65
62
  PanelFormSection,
63
+ PlayIcon,
66
64
  } from '@finos/legend-art';
67
65
  import {
68
66
  assertErrorThrown,
69
- generateEnumerableNameFromToken,
70
- guaranteeNonNullable,
67
+ filterByType,
71
68
  prettyCONSTName,
69
+ returnUndefOnError,
72
70
  uniq,
73
71
  } from '@finos/legend-shared';
74
- import {
75
- type StoreTestDataState,
76
- type MappingTestableState,
77
- type MappingTestableQueryState,
78
- type MappingTestState,
79
- type MappingTestableDataState,
80
- type MappingTestSuiteState,
81
- MAPPING_TEST_SUITE_TYPE,
82
- MappingQueryTestSuiteState,
83
- MappingDataTestState,
84
- MappingDataTestSuiteState,
85
- MappingQueryTestState,
72
+ import type {
73
+ StoreTestDataState,
74
+ MappingTestableState,
75
+ MappingTestState,
76
+ MappingTestSuiteState,
77
+ CreateSuiteState,
86
78
  } from '../../../../stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js';
87
- import { useApplicationStore } from '@finos/legend-application';
79
+ import {
80
+ useApplicationNavigationContext,
81
+ useApplicationStore,
82
+ } from '@finos/legend-application';
88
83
  import { flowResult } from 'mobx';
89
84
  import {
90
85
  QueryBuilderTextEditorMode,
@@ -95,23 +90,23 @@ import {
95
90
  CODE_EDITOR_LANGUAGE,
96
91
  CodeEditor,
97
92
  } from '@finos/legend-lego/code-editor';
98
- import { TESTABLE_TEST_TAB } from '../../../../stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js';
99
- import {
100
- atomicTest_setDoc,
101
- testAssertion_setId,
102
- } from '../../../../stores/graph-modifier/Testable_GraphModifierHelper.js';
93
+ import { atomicTest_setDoc } from '../../../../stores/graph-modifier/Testable_GraphModifierHelper.js';
103
94
  import {
104
95
  RenameModal,
96
+ SharedDataElementModal,
105
97
  TestAssertionEditor,
106
- TestAssertionItem,
107
98
  } from '../testable/TestableSharedComponents.js';
108
99
  import { EmbeddedDataEditor } from '../data-editor/EmbeddedDataEditor.js';
109
100
  import {
110
101
  TESTABLE_RESULT,
111
102
  getTestableResultFromTestResult,
103
+ getTestableResultFromTestResults,
112
104
  } from '../../../../stores/editor/sidebar-state/testable/GlobalTestRunnerState.js';
113
105
  import { getTestableResultIcon } from '../../side-bar/testable/GlobalTestRunner.js';
114
- import { validateTestableId } from '../../../../stores/editor/utils/TestableUtils.js';
106
+ import {
107
+ EmbeddedDataCreatorFromEmbeddedData,
108
+ validateTestableId,
109
+ } from '../../../../stores/editor/utils/TestableUtils.js';
115
110
  import { getMappingStores } from '../../../../stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js';
116
111
  import type { DSL_Data_LegendStudioApplicationPlugin_Extension } from '../../../../stores/extensions/DSL_Data_LegendStudioApplicationPlugin_Extension.js';
117
112
  import { EmbeddedDataType } from '../../../../stores/editor/editor-state/ExternalFormatState.js';
@@ -121,49 +116,26 @@ import {
121
116
  getPackageableElementOptionFormatter,
122
117
  type PackageableElementOption,
123
118
  } from '@finos/legend-lego/graph-editor';
119
+ import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__lib__/LegendStudioApplicationNavigationContext.js';
124
120
 
125
- const SOURCE_CLASS_FORM_TITLE = 'Source Class To Add Data';
126
- const SOURCE_CLASS_FORM_PROMPT = 'Source class to provide test data for';
127
- const TARGET_CLASS_FORM_TITLE = 'Target Class To Test';
128
- const TARGET_CLASS_FORM_PROMPT =
129
- 'Mapped class for which you would like to build test query';
130
121
  interface ClassSelectOption {
131
122
  label: string;
132
123
  value: Class;
133
124
  }
134
125
 
135
126
  const CreateTestSuiteModal = observer(
136
- (props: { mappingTestableState: MappingTestableState }) => {
137
- const { mappingTestableState } = props;
127
+ (props: { creatorState: CreateSuiteState }) => {
128
+ const { creatorState } = props;
129
+ const mappingTestableState = creatorState.mappingTestableState;
138
130
  const mappingEditorState = mappingTestableState.mappingEditorState;
139
131
  const mapping = mappingEditorState.mapping;
140
- const creatorState = mappingTestableState.createSuiteState;
141
132
  const editorStore = mappingEditorState.editorStore;
142
- // quick funcs
143
- const getDefaultSuite = (
144
- val: Class | undefined,
145
- ): MAPPING_TEST_SUITE_TYPE => {
146
- if (val) {
147
- const rootSetImpl = getRootSetImplementation(mapping, val);
148
- if (
149
- rootSetImpl instanceof RelationalInstanceSetImplementation ||
150
- rootSetImpl instanceof EmbeddedRelationalInstanceSetImplementation ||
151
- rootSetImpl instanceof EmbeddedRelationalInstanceSetImplementation
152
- ) {
153
- return MAPPING_TEST_SUITE_TYPE.DATA;
154
- } else {
155
- return MAPPING_TEST_SUITE_TYPE.QUERY;
156
- }
157
- }
158
- return MAPPING_TEST_SUITE_TYPE.QUERY;
159
- };
160
133
  // Class mapping selector
161
134
  const compatibleClasses = getMappingCompatibleClasses(
162
135
  mapping,
163
136
  editorStore.graphManagerState.usableClasses,
164
137
  );
165
138
  const inputRef = useRef<HTMLInputElement>(null);
166
-
167
139
  const handleEnter = (): void => inputRef.current?.focus();
168
140
  const mappedClassOptions = uniq(compatibleClasses)
169
141
  .map((e) => ({
@@ -181,38 +153,33 @@ const CreateTestSuiteModal = observer(
181
153
  }
182
154
  : null;
183
155
  // init states
184
- const [suiteType, setSuiteType] = useState(getDefaultSuite(selectedClass));
185
156
  const [suiteName, setSuiteName] = useState<string | undefined>(undefined);
186
157
  const [testName, setTestName] = useState<string | undefined>(undefined);
187
-
188
158
  const isValid = selectedClass && suiteName && testName;
189
159
  const changeClassOption = (val: ClassSelectOption | null): void => {
190
160
  if (val?.value) {
191
161
  setSelectedClass(val.value);
192
- setSuiteType(getDefaultSuite(val.value));
193
162
  } else {
194
163
  setSelectedClass(undefined);
195
- setSuiteType(getDefaultSuite(undefined));
196
164
  }
197
165
  };
198
-
199
166
  // model
200
- const close = (): void => creatorState.setShowModal(false);
167
+ const close = (): void => mappingTestableState.closeCreateModal();
201
168
  const create = (): void => {
202
169
  if (selectedClass && suiteName && testName) {
203
170
  flowResult(
204
171
  creatorState.createAndAddTestSuite(
205
172
  selectedClass,
206
- suiteType,
207
173
  suiteName,
208
174
  testName,
209
175
  ),
210
176
  ).catch(editorStore.applicationStore.alertUnhandledError);
211
177
  }
212
178
  };
179
+
213
180
  return (
214
181
  <Dialog
215
- open={creatorState.showModal}
182
+ open={true}
216
183
  onClose={close}
217
184
  TransitionProps={{
218
185
  onEnter: handleEnter,
@@ -294,83 +261,54 @@ const CreateTestModal = observer(
294
261
  (props: { mappingSuiteState: MappingTestSuiteState }) => {
295
262
  const { mappingSuiteState } = props;
296
263
  const mapping = mappingSuiteState.mappingTestableState.mapping;
297
- const editorStore =
298
- mappingSuiteState.mappingTestableState.mappingEditorState.editorStore;
264
+ const suite = mappingSuiteState.suite;
265
+ const testData = suite.tests.filter(filterByType(MappingTest))[0]
266
+ ?.storeTestData[0];
267
+ const editorStore = mappingSuiteState.editorStore;
268
+ // test name
269
+ const [id, setId] = useState<string | undefined>(undefined);
270
+ const isValid = id && !id.includes(' ');
271
+ const errorMessage = validateTestableId(
272
+ id,
273
+ suite.tests.map((t) => t.id),
274
+ );
275
+ const mappedClassSelectorRef = useRef<SelectComponent>(null);
276
+
277
+ // const firstTest = mapp
299
278
  // Class mapping selector
300
279
  const compatibleClasses = getMappingCompatibleClasses(
301
280
  mapping,
302
281
  editorStore.graphManagerState.usableClasses,
303
282
  );
304
- const suite = mappingSuiteState.suite;
305
- const getDefaultTestName = (
306
- useClass: boolean,
307
- _class: Class | undefined,
308
- ): string => {
309
- if (useClass && _class) {
310
- return `${_class.name}_test`;
311
- }
312
- return 'test';
313
- };
314
- // class
283
+ const mappedClassOptions = uniq(compatibleClasses)
284
+ .map((e) => ({
285
+ label: e.name,
286
+ value: e,
287
+ }))
288
+ .sort(compareLabelFn);
289
+
290
+ // class if required
315
291
  const [selectedClass, setSelectedClass] = useState<Class | undefined>(
316
- mappingSuiteState.getDefaultClass(),
292
+ compatibleClasses[0],
317
293
  );
294
+ const changeClassOption = (val: ClassSelectOption | null): void => {
295
+ setSelectedClass(val?.value);
296
+ };
318
297
  const selectedClassOption = selectedClass
319
298
  ? {
320
299
  value: selectedClass,
321
300
  label: selectedClass.name,
322
301
  }
323
302
  : null;
324
-
325
- // id
326
- const [id, setId] = useState(
327
- generateEnumerableNameFromToken(
328
- suite.tests.map((e) => e.id),
329
- getDefaultTestName(
330
- mappingSuiteState instanceof MappingDataTestSuiteState,
331
- selectedClass,
332
- ),
333
- ),
334
- );
335
-
336
- const changeClassOption = (val: ClassSelectOption | null): void => {
337
- setSelectedClass(val?.value);
338
- setId(
339
- generateEnumerableNameFromToken(
340
- suite.tests.map((e) => e.id),
341
- getDefaultTestName(
342
- mappingSuiteState instanceof MappingDataTestSuiteState,
343
- selectedClass,
344
- ),
345
- ),
346
- );
347
- };
348
-
349
- const isValid = id && !id.includes(' ');
350
-
351
- const mappedClassSelectorRef = useRef<SelectComponent>(null);
352
- const mappedClassOptions = uniq(compatibleClasses)
353
- .map((e) => ({
354
- label: e.name,
355
- value: e,
356
- }))
357
- .sort(compareLabelFn);
358
-
359
303
  // model
360
304
  const close = (): void => mappingSuiteState.setShowModal(false);
361
305
  const create = (): void => {
362
- mappingSuiteState.addNewTest(id, selectedClass);
363
- close();
306
+ if (id) {
307
+ mappingSuiteState.addNewTest(id, selectedClass);
308
+ close();
309
+ }
364
310
  };
365
311
 
366
- const modalTitle =
367
- mappingSuiteState instanceof MappingDataTestSuiteState
368
- ? TARGET_CLASS_FORM_TITLE
369
- : SOURCE_CLASS_FORM_TITLE;
370
- const modalPrompt =
371
- mappingSuiteState instanceof MappingDataTestSuiteState
372
- ? TARGET_CLASS_FORM_PROMPT
373
- : SOURCE_CLASS_FORM_PROMPT;
374
312
  return (
375
313
  <Dialog
376
314
  open={mappingSuiteState.showCreateModal}
@@ -378,39 +316,37 @@ const CreateTestModal = observer(
378
316
  classes={{ container: 'search-modal__container' }}
379
317
  PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
380
318
  >
381
- <Modal darkMode={true} className="search-modal">
382
- <ModalTitle title="Create Test" />
319
+ <Modal darkMode={true}>
320
+ <ModalHeader>
321
+ <ModalTitle title="Create Mapping Test" />
322
+ </ModalHeader>
383
323
  <ModalBody>
384
324
  <PanelFormTextField
385
325
  name="Name"
386
326
  prompt=""
387
327
  value={id}
388
328
  update={(value: string | undefined): void => setId(value ?? '')}
389
- errorMessage={
390
- id.includes(' ')
391
- ? `Suite name can't contain spaces`
392
- : !id
393
- ? `Suite name is required`
394
- : undefined
395
- }
329
+ errorMessage={errorMessage}
396
330
  />
397
- <div className="panel__content__form__section">
398
- <div className="panel__content__form__section__header__label">
399
- {modalTitle}
400
- </div>
401
- <div className="panel__content__form__section__header__prompt">
402
- {modalPrompt}
331
+ {!testData && (
332
+ <div className="panel__content__form__section">
333
+ <div className="panel__content__form__section__header__label">
334
+ Class Mapping
335
+ </div>
336
+ <div className="panel__content__form__section__header__prompt">
337
+ Mapped Class for which you would like to build test suite for
338
+ </div>
339
+ <CustomSelectorInput
340
+ ref={mappedClassSelectorRef}
341
+ options={mappedClassOptions}
342
+ onChange={changeClassOption}
343
+ value={selectedClassOption}
344
+ darkMode={true}
345
+ placeholder="Choose a class..."
346
+ isClearable={true}
347
+ />
403
348
  </div>
404
- <CustomSelectorInput
405
- ref={mappedClassSelectorRef}
406
- options={mappedClassOptions}
407
- onChange={changeClassOption}
408
- value={selectedClassOption}
409
- darkMode={true}
410
- placeholder="Choose a class..."
411
- isClearable={true}
412
- />
413
- </div>
349
+ )}
414
350
  </ModalBody>
415
351
  <ModalFooter>
416
352
  <ModalFooterButton
@@ -432,8 +368,9 @@ interface StoreSelectOption {
432
368
  }
433
369
 
434
370
  const CreateStoreTestDataModal = observer(
435
- (props: { mappingTestableDataState: MappingTestableDataState }) => {
436
- const { mappingTestableDataState } = props;
371
+ (props: { mappingTestState: MappingTestState }) => {
372
+ const { mappingTestState } = props;
373
+ const mappingTestableDataState = mappingTestState.dataState;
437
374
  const editorStore = mappingTestableDataState.editorStore;
438
375
  const mapping = mappingTestableDataState.mappingTestableState.mapping;
439
376
  const isReadOnly =
@@ -565,6 +502,7 @@ const CreateStoreTestDataModal = observer(
565
502
  ref={mappedStoreRef}
566
503
  options={selectedStoreOptions}
567
504
  onChange={changeStoreOption}
505
+ formatOptionLabel={getPackageableElementOptionFormatter({})}
568
506
  value={selectedStoreOption}
569
507
  darkMode={true}
570
508
  placeholder="Choose a store..."
@@ -622,15 +560,15 @@ const CreateStoreTestDataModal = observer(
622
560
  },
623
561
  );
624
562
 
625
- const MappingTestableQueryEditor = observer(
563
+ const MappingTestSuiteQueryEditor = observer(
626
564
  (props: {
627
- testableQueryState: MappingTestableQueryState;
565
+ testSuiteState: MappingTestSuiteState;
628
566
  mappingTestableState: MappingTestableState;
629
567
  isReadOnly: boolean;
630
568
  }) => {
631
- const { testableQueryState, mappingTestableState, isReadOnly } = props;
569
+ const { testSuiteState, mappingTestableState, isReadOnly } = props;
570
+ const testableQueryState = testSuiteState.queryState;
632
571
  const mapping = mappingTestableState.mapping;
633
- const queryState = testableQueryState;
634
572
  const editorStore = mappingTestableState.mappingEditorState.editorStore;
635
573
  const applicationStore = useApplicationStore();
636
574
 
@@ -664,7 +602,9 @@ const MappingTestableQueryEditor = observer(
664
602
  async (): Promise<void> => {
665
603
  try {
666
604
  const rawLambda = queryBuilderState.buildQuery();
667
- await flowResult(queryState.updateLamba(rawLambda));
605
+ await flowResult(
606
+ testableQueryState.updateLamba(rawLambda),
607
+ );
668
608
  applicationStore.notificationService.notifySuccess(
669
609
  `Mapping testable query is updated`,
670
610
  );
@@ -692,13 +632,13 @@ const MappingTestableQueryEditor = observer(
692
632
  },
693
633
  },
694
634
  ],
695
- disableCompile: isStubbed_RawLambda(queryState.query),
635
+ disableCompile: isStubbed_RawLambda(testableQueryState.query),
696
636
  }),
697
637
  );
698
638
  });
699
639
 
700
640
  const clearQuery = applicationStore.guardUnhandledError(() =>
701
- flowResult(queryState.updateLamba(stub_RawLambda())),
641
+ flowResult(testableQueryState.updateLamba(stub_RawLambda())),
702
642
  );
703
643
 
704
644
  return (
@@ -748,11 +688,11 @@ const MappingTestableQueryEditor = observer(
748
688
  </div>
749
689
  </div>
750
690
  </div>
751
- {!isStubbed_RawLambda(queryState.query) && (
691
+ {!isStubbed_RawLambda(testableQueryState.query) && (
752
692
  <PanelContent>
753
693
  <div className="mapping-test-editor__query-panel__query">
754
694
  <CodeEditor
755
- inputValue={queryState.lambdaString}
695
+ inputValue={testableQueryState.lambdaString}
756
696
  isReadOnly={true}
757
697
  language={CODE_EDITOR_LANGUAGE.PURE}
758
698
  hideMinimap={true}
@@ -765,140 +705,87 @@ const MappingTestableQueryEditor = observer(
765
705
  },
766
706
  );
767
707
 
768
- const MappingTestAssertionsEditor = observer(
769
- (props: { mappingDataTestState: MappingTestState }) => {
770
- const { mappingDataTestState } = props;
771
- const editorStore = mappingDataTestState.editorStore;
772
- const mappingEditorState =
773
- mappingDataTestState.mappingTestableState.mappingEditorState;
774
- const isReadOnly = mappingEditorState.isReadOnly;
775
- const addAssertion = (): void => mappingDataTestState.addAssertion();
776
- const runTest = (): void => {
777
- flowResult(mappingDataTestState.runTest()).catch(
778
- editorStore.applicationStore.alertUnhandledError,
779
- );
780
- };
781
- const renameAssertion = (val: string): void =>
782
- testAssertion_setId(
783
- guaranteeNonNullable(mappingDataTestState.assertionToRename),
784
- val,
785
- );
786
- return (
787
- <div className="panel service-test-editor">
788
- <div className="service-test-suite-editor__header">
789
- <div className="service-test-suite-editor__header__title">
790
- <div className="service-test-suite-editor__header__title__label service-test-suite-editor__header__title__label--assertions">
791
- assertions
792
- </div>
793
- </div>
794
- </div>
795
- <div className="service-test-editor__content">
796
- <ResizablePanelGroup orientation="vertical">
797
- <ResizablePanel minSize={100} size={200}>
798
- <div className="binding-editor__header">
799
- <div className="binding-editor__header__title">
800
- <div className="testable-test-assertion-explorer__header__summary">
801
- <div className="testable-test-assertion-explorer__header__summary__icon testable-test-assertion-explorer__header__summary__icon--assertion">
802
- <TestTubeIcon />
803
- </div>
804
- <div>{mappingDataTestState.assertionCount}</div>
805
- </div>
806
- <div className="testable-test-assertion-explorer__header__summary">
807
- <div className="testable-test-assertion-explorer__header__summary__icon testable-test-assertion-explorer__header__summary__icon--passed">
808
- <CheckCircleIcon />
809
- </div>
810
- <div>{mappingDataTestState.assertionPassed}</div>
811
- </div>
812
- <div className="testable-test-assertion-explorer__header__summary">
813
- <div className="testable-test-assertion-explorer__header__summary__icon testable-test-assertion-explorer__header__summary__icon--failed">
814
- <TimesCircleIcon />
815
- </div>
816
- <div>{mappingDataTestState.assertionFailed}</div>
817
- </div>
818
- </div>
819
- <div className="panel__header__actions">
820
- <button
821
- className="panel__header__action testable-test-explorer__play__all__icon"
822
- tabIndex={-1}
823
- onClick={runTest}
824
- title="Run All Assertions"
825
- >
826
- <RunAllIcon />
827
- </button>
828
- <button
829
- className="panel__header__action"
830
- tabIndex={-1}
831
- onClick={addAssertion}
832
- title="Add Test Assertion"
833
- >
834
- <PlusIcon />
835
- </button>
836
- </div>
837
- </div>
838
- <div>
839
- {mappingDataTestState.assertionEditorStates.map(
840
- (assertionState) => (
841
- <TestAssertionItem
842
- key={assertionState.assertion.id}
843
- testableTestState={mappingDataTestState}
844
- testAssertionEditorState={assertionState}
845
- isReadOnly={isReadOnly}
846
- />
847
- ),
848
- )}
849
- </div>
850
- {mappingDataTestState.assertionToRename && (
851
- <RenameModal
852
- val={mappingDataTestState.assertionToRename.id}
853
- isReadOnly={isReadOnly}
854
- showModal={true}
855
- closeModal={(): void =>
856
- mappingDataTestState.setAssertionToRename(undefined)
857
- }
858
- setValue={renameAssertion}
859
- errorMessageFunc={(_val: string | undefined) =>
860
- validateTestableId(_val, undefined)
861
- }
862
- />
863
- )}
864
- </ResizablePanel>
865
- <ResizablePanelSplitter>
866
- <ResizablePanelSplitterLine color="var(--color-dark-grey-200)" />
867
- </ResizablePanelSplitter>
868
- <ResizablePanel>
869
- {mappingDataTestState.selectedAsertionState && (
870
- <TestAssertionEditor
871
- testAssertionState={
872
- mappingDataTestState.selectedAsertionState
873
- }
874
- />
875
- )}
876
- </ResizablePanel>
877
- </ResizablePanelGroup>
878
- </div>
879
- </div>
880
- );
881
- },
882
- );
883
-
884
708
  const StoreTestDataEditor = observer(
885
709
  (props: {
886
- mappingTestableDataState: MappingTestableDataState;
710
+ mappingTestState: MappingTestState;
887
711
  storeTestDataState: StoreTestDataState;
888
712
  }) => {
889
- const { mappingTestableDataState, storeTestDataState } = props;
713
+ const { mappingTestState, storeTestDataState } = props;
890
714
  const isReadOnly =
891
- mappingTestableDataState.mappingTestableState.mappingEditorState
892
- .isReadOnly;
715
+ mappingTestState.mappingTestableState.mappingEditorState.isReadOnly;
716
+ const dataElements =
717
+ storeTestDataState.editorStore.graphManagerState.graph.dataElements;
718
+ const data = storeTestDataState.storeTestData.data;
719
+ const isUsingReference = data instanceof DataElementReference;
720
+ const open = (): void => storeTestDataState.setDataElementModal(true);
721
+ const close = (): void => storeTestDataState.setDataElementModal(false);
722
+ const changeToUseMyOwn = (): void => {
723
+ if (isUsingReference) {
724
+ const newBare = returnUndefOnError(() =>
725
+ data.accept_EmbeddedDataVisitor(
726
+ new EmbeddedDataCreatorFromEmbeddedData(),
727
+ ),
728
+ );
729
+ if (newBare) {
730
+ storeTestDataState.changeEmbeddedData(newBare);
731
+ }
732
+ }
733
+ };
734
+
735
+ const handler = (val: DataElement): void => {
736
+ const value = new DataElementReference();
737
+ value.dataElement = PackageableElementExplicitReference.create(val);
738
+ storeTestDataState.changeEmbeddedData(value);
739
+ };
893
740
  return (
894
741
  <div className="service-test-data-editor">
895
742
  <div className="service-test-suite-editor__header">
896
743
  <div className="service-test-suite-editor__header__title">
897
744
  <div className="service-test-suite-editor__header__title__label">
898
- test data input
745
+ input data
899
746
  </div>
900
747
  </div>
748
+ <div className="panel__header__actions">
749
+ {isUsingReference ? (
750
+ <button
751
+ className="panel__header__action service-execution-editor__test-data__generate-btn"
752
+ onClick={changeToUseMyOwn}
753
+ disabled={!isUsingReference}
754
+ title="Use own data"
755
+ tabIndex={-1}
756
+ >
757
+ <div className="service-execution-editor__test-data__generate-btn__label">
758
+ <div className="service-execution-editor__test-data__generate-btn__label__title">
759
+ Own Data
760
+ </div>
761
+ </div>
762
+ </button>
763
+ ) : (
764
+ <button
765
+ className="panel__header__action service-execution-editor__test-data__generate-btn"
766
+ onClick={open}
767
+ title="Use Shared Data via Defined Data Element"
768
+ disabled={!dataElements.length}
769
+ tabIndex={-1}
770
+ >
771
+ <div className="service-execution-editor__test-data__generate-btn__label">
772
+ <div className="service-execution-editor__test-data__generate-btn__label__title">
773
+ Shared Data
774
+ </div>
775
+ </div>
776
+ </button>
777
+ )}
778
+ </div>
901
779
  </div>
780
+
781
+ {storeTestDataState.dataElementModal && (
782
+ <SharedDataElementModal
783
+ isReadOnly={false}
784
+ editorStore={storeTestDataState.editorStore}
785
+ close={close}
786
+ handler={handler}
787
+ />
788
+ )}
902
789
  <EmbeddedDataEditor
903
790
  isReadOnly={isReadOnly}
904
791
  embeddedDataEditorState={storeTestDataState.embeddedEditorState}
@@ -908,69 +795,36 @@ const StoreTestDataEditor = observer(
908
795
  },
909
796
  );
910
797
 
911
- const MappingTestableStoreDataEditor = observer(
912
- (props: { mappingTestableDataState: MappingTestableDataState }) => {
913
- const { mappingTestableDataState } = props;
798
+ const MappingTestEditor = observer(
799
+ (props: { mappingTestState: MappingTestState }) => {
800
+ const { mappingTestState } = props;
801
+ const mappingTest = mappingTestState.test;
802
+ const mappingTestableDataState = mappingTestState.dataState;
914
803
  const addStoreTestData = (): void => {
915
804
  mappingTestableDataState.setShowModal(true);
916
805
  };
917
- return (
918
- <div className="service-test-data-editor panel">
919
- {mappingTestableDataState.dataHolder.storeTestData.length ? (
920
- <>
921
- <PanelLoadingIndicator
922
- isLoading={Boolean(
923
- mappingTestableDataState.selectedDataState
924
- ?.generatingTestDataSate.isInProgress,
925
- )}
926
- />
927
- {mappingTestableDataState.selectedDataState && (
928
- <StoreTestDataEditor
929
- storeTestDataState={mappingTestableDataState.selectedDataState}
930
- mappingTestableDataState={mappingTestableDataState}
931
- />
932
- )}
933
- </>
934
- ) : (
935
- <BlankPanelPlaceholder
936
- text="Add Store Test Data"
937
- onClick={addStoreTestData}
938
- clickActionType="add"
939
- tooltipText="Click to add store test data"
940
- />
941
- )}
942
- {mappingTestableDataState.showNewModal && (
943
- <CreateStoreTestDataModal
944
- mappingTestableDataState={mappingTestableDataState}
945
- />
946
- )}
947
- </div>
948
- );
949
- },
950
- );
951
806
 
952
- const MappingTestEditor = observer(
953
- (props: { mappingTestState: MappingTestState }) => {
954
- const { mappingTestState } = props;
955
- const selectedTab = mappingTestState.selectedTab;
956
- const isReadOnly =
957
- mappingTestState.mappingTestableState.mappingEditorState.isReadOnly;
958
- const renderMappingSetupTestEditor = (): React.ReactNode => {
959
- const test = mappingTestState.test;
960
- return (
961
- <div className="panel mapping-testable-editorr">
807
+ return (
808
+ <div className="service-test-editor panel">
809
+ <div className="panel mapping-testable-editor">
962
810
  <div className="mapping-testable-editor__content">
963
811
  <ResizablePanelGroup orientation="horizontal">
964
- <ResizablePanel size={150}>
812
+ <ResizablePanel size={120}>
965
813
  <div className="service-test-data-editor panel">
966
814
  <div className="service-test-editor__setup__configuration">
967
- <PanelFormTextField
968
- name="Test Documentation"
969
- value={test.doc}
970
- update={(value: string | undefined): void =>
971
- atomicTest_setDoc(test, value)
972
- }
973
- />
815
+ <div className="panel__content__form__section">
816
+ <div className="panel__content__form__section__header__label">
817
+ Test Documentation
818
+ </div>
819
+ <textarea
820
+ className="panel__content__form__section__textarea mapping-testable-editor__doc__textarea"
821
+ spellCheck={false}
822
+ value={mappingTest.doc}
823
+ onChange={(event) => {
824
+ atomicTest_setDoc(mappingTest, event.target.value);
825
+ }}
826
+ />
827
+ </div>
974
828
  </div>
975
829
  </div>
976
830
  </ResizablePanel>
@@ -978,54 +832,53 @@ const MappingTestEditor = observer(
978
832
  <ResizablePanelSplitterLine color="var(--color-dark-grey-200)" />
979
833
  </ResizablePanelSplitter>
980
834
  <ResizablePanel>
981
- {mappingTestState instanceof MappingQueryTestState && (
982
- <MappingTestableQueryEditor
983
- testableQueryState={mappingTestState.queryState}
984
- mappingTestableState={mappingTestState.mappingTestableState}
985
- isReadOnly={isReadOnly}
986
- />
987
- )}
988
- {mappingTestState instanceof MappingDataTestState && (
989
- <MappingTestableStoreDataEditor
990
- mappingTestableDataState={mappingTestState.dataState}
991
- />
992
- )}
835
+ <ResizablePanelGroup orientation="vertical">
836
+ <ResizablePanel>
837
+ <div className="service-test-data-editor panel">
838
+ {mappingTestableDataState.dataHolder.storeTestData
839
+ .length ? (
840
+ <>
841
+ {mappingTestableDataState.selectedDataState && (
842
+ <StoreTestDataEditor
843
+ storeTestDataState={
844
+ mappingTestableDataState.selectedDataState
845
+ }
846
+ mappingTestState={mappingTestState}
847
+ />
848
+ )}
849
+ </>
850
+ ) : (
851
+ <BlankPanelPlaceholder
852
+ text="Add Store Test Data"
853
+ onClick={addStoreTestData}
854
+ clickActionType="add"
855
+ tooltipText="Click to add store test data"
856
+ />
857
+ )}
858
+ {mappingTestableDataState.showNewModal && (
859
+ <CreateStoreTestDataModal
860
+ mappingTestState={mappingTestState}
861
+ />
862
+ )}
863
+ </div>
864
+ </ResizablePanel>
865
+ <ResizablePanelSplitter>
866
+ <ResizablePanelSplitterLine color="var(--color-dark-grey-200)" />
867
+ </ResizablePanelSplitter>
868
+ <ResizablePanel>
869
+ {mappingTestState.selectedAsertionState && (
870
+ <TestAssertionEditor
871
+ testAssertionState={
872
+ mappingTestState.selectedAsertionState
873
+ }
874
+ />
875
+ )}
876
+ </ResizablePanel>
877
+ </ResizablePanelGroup>
993
878
  </ResizablePanel>
994
879
  </ResizablePanelGroup>
995
880
  </div>
996
881
  </div>
997
- );
998
- };
999
- return (
1000
- <div className="service-test-editor panel">
1001
- <div className="panel__header">
1002
- <div className="panel__header service-test-editor__header--with-tabs">
1003
- <div className="uml-element-editor__tabs">
1004
- {Object.values(TESTABLE_TEST_TAB).map((tab) => (
1005
- <div
1006
- key={tab}
1007
- onClick={(): void => mappingTestState.setSelectedTab(tab)}
1008
- className={clsx('service-test-editor__tab', {
1009
- 'service-test-editor__tab--active':
1010
- tab === mappingTestState.selectedTab,
1011
- })}
1012
- >
1013
- {prettyCONSTName(tab)}
1014
- </div>
1015
- ))}
1016
- </div>
1017
- </div>
1018
- </div>
1019
- <div className="service-test-editor">
1020
- {selectedTab === TESTABLE_TEST_TAB.SETUP &&
1021
- renderMappingSetupTestEditor()}
1022
-
1023
- {selectedTab === TESTABLE_TEST_TAB.ASSERTION && (
1024
- <MappingTestAssertionsEditor
1025
- mappingDataTestState={mappingTestState}
1026
- />
1027
- )}
1028
- </div>
1029
882
  </div>
1030
883
  );
1031
884
  },
@@ -1096,6 +949,11 @@ const MappingTestItem = observer(
1096
949
  const rename = (): void => {
1097
950
  suiteState.mappingTestableState.setRenameComponent(mappingTest);
1098
951
  };
952
+ const runTest = (): void => {
953
+ flowResult(mappingTestState.runTest()).catch(
954
+ mappingTestState.editorStore.applicationStore.alertUnhandledError,
955
+ );
956
+ };
1099
957
  return (
1100
958
  <ContextMenu
1101
959
  className={clsx(
@@ -1130,6 +988,17 @@ const MappingTestItem = observer(
1130
988
  <div className="testable-test-explorer__item__label__text">
1131
989
  {mappingTest.id}
1132
990
  </div>
991
+ <div className="mapping-test-explorer__item__actions">
992
+ <button
993
+ className="mapping-test-explorer__item__action mapping-test-explorer__run-test-btn"
994
+ onClick={runTest}
995
+ disabled={mappingTestState.runningTestAction.isInProgress}
996
+ tabIndex={-1}
997
+ title={`Run ${mappingTestState.test.id}`}
998
+ >
999
+ {<PlayIcon />}
1000
+ </button>
1001
+ </div>
1133
1002
  </button>
1134
1003
  </ContextMenu>
1135
1004
  );
@@ -1154,25 +1023,6 @@ const MappingTestSuiteEditor = observer(
1154
1023
  editorStore.applicationStore.alertUnhandledError,
1155
1024
  );
1156
1025
  };
1157
- const renderMappingTestSuiteDriver = (): React.ReactNode => {
1158
- if (mappingTestSuiteState instanceof MappingDataTestSuiteState) {
1159
- return (
1160
- <MappingTestableStoreDataEditor
1161
- mappingTestableDataState={mappingTestSuiteState.dataState}
1162
- />
1163
- );
1164
- } else if (mappingTestSuiteState instanceof MappingQueryTestSuiteState) {
1165
- return (
1166
- <MappingTestableQueryEditor
1167
- key={mappingTestSuiteState.queryState.uuid}
1168
- testableQueryState={mappingTestSuiteState.queryState}
1169
- mappingTestableState={mappingTestSuiteState.mappingTestableState}
1170
- isReadOnly={isReadOnly}
1171
- />
1172
- );
1173
- }
1174
- return null;
1175
- };
1176
1026
  const renderMappingTestEditor = (): React.ReactNode => {
1177
1027
  if (selectedTestState) {
1178
1028
  return <MappingTestEditor mappingTestState={selectedTestState} />;
@@ -1191,14 +1041,19 @@ const MappingTestSuiteEditor = observer(
1191
1041
  return (
1192
1042
  <ResizablePanelGroup orientation="horizontal">
1193
1043
  <ResizablePanel size={300} minSize={28}>
1194
- {renderMappingTestSuiteDriver()}
1044
+ <MappingTestSuiteQueryEditor
1045
+ key={mappingTestSuiteState.queryState.uuid}
1046
+ testSuiteState={mappingTestSuiteState}
1047
+ mappingTestableState={mappingTestSuiteState.mappingTestableState}
1048
+ isReadOnly={isReadOnly}
1049
+ />
1195
1050
  </ResizablePanel>
1196
1051
  <ResizablePanelSplitter>
1197
1052
  <ResizablePanelSplitterLine color="var(--color-dark-grey-200)" />
1198
1053
  </ResizablePanelSplitter>
1199
1054
  <ResizablePanel minSize={56}>
1200
1055
  <ResizablePanelGroup orientation="vertical">
1201
- <ResizablePanel size={300} minSize={28}>
1056
+ <ResizablePanel size={200} minSize={28}>
1202
1057
  <div className="binding-editor__header">
1203
1058
  <div className="binding-editor__header__title">
1204
1059
  <div className="panel__header__title__content">Tests</div>
@@ -1224,7 +1079,7 @@ const MappingTestSuiteEditor = observer(
1224
1079
  className="panel__header__action"
1225
1080
  tabIndex={-1}
1226
1081
  onClick={addTest}
1227
- title="Add Mapping Suite"
1082
+ title="Add Mapping Test"
1228
1083
  >
1229
1084
  <PlusIcon />
1230
1085
  </button>
@@ -1266,18 +1121,24 @@ const MappingTestSuiteItem = observer(
1266
1121
  useState(false);
1267
1122
  const isReadOnly = mappingTestableState.mappingEditorState.isReadOnly;
1268
1123
  const openSuite = (): void => mappingTestableState.changeSuite(suite);
1124
+ const results = mappingTestableState.testableResults?.filter(
1125
+ (t) => t.parentSuite?.id === suite.id,
1126
+ );
1127
+ const isRunning =
1128
+ mappingTestableState.isRunningTestableSuitesState.isInProgress ||
1129
+ (mappingTestableState.isRunningFailingSuitesState.isInProgress &&
1130
+ mappingTestableState.failingSuites.includes(suite)) ||
1131
+ mappingTestableState.runningSuite === suite;
1269
1132
  const isActive = mappingTestableState.selectedTestSuite?.suite === suite;
1270
- // const _testableResult = getTestableResultFromTestResult(
1271
- // serviceTestState.testResultState.result,
1272
- // );
1273
- // const testableResult = isRunning
1274
- // ? TESTABLE_RESULT.IN_PROGRESS
1275
- // : _testableResult;
1276
- // const resultIcon = getTestableResultIcon(testableResult);
1133
+ const _testableResult = getTestableResultFromTestResults(results);
1134
+ const testableResult = isRunning
1135
+ ? TESTABLE_RESULT.IN_PROGRESS
1136
+ : _testableResult;
1137
+ const resultIcon = getTestableResultIcon(testableResult);
1277
1138
  const onContextMenuOpen = (): void => setIsSelectedFromContextMenu(true);
1278
1139
  const onContextMenuClose = (): void => setIsSelectedFromContextMenu(false);
1279
1140
  const add = (): void => {
1280
- mappingTestableState.createSuiteState.setShowModal(true);
1141
+ mappingTestableState.openCreateModal();
1281
1142
  };
1282
1143
  const _delete = (): void => {
1283
1144
  mappingTestableState.deleteTestSuite(suite);
@@ -1285,6 +1146,11 @@ const MappingTestSuiteItem = observer(
1285
1146
  const rename = (): void => {
1286
1147
  mappingTestableState.setRenameComponent(suite);
1287
1148
  };
1149
+ const runSuite = (): void => {
1150
+ flowResult(mappingTestableState.runSuite(suite)).catch(
1151
+ mappingTestableState.editorStore.applicationStore.alertUnhandledError,
1152
+ );
1153
+ };
1288
1154
  return (
1289
1155
  <ContextMenu
1290
1156
  className={clsx(
@@ -1314,11 +1180,22 @@ const MappingTestSuiteItem = observer(
1314
1180
  tabIndex={-1}
1315
1181
  >
1316
1182
  <div className="testable-test-explorer__item__label__icon">
1317
- {/* {resultIcon} */}
1183
+ {resultIcon}
1318
1184
  </div>
1319
1185
  <div className="testable-test-explorer__item__label__text">
1320
1186
  {suite.id}
1321
1187
  </div>
1188
+ <div className="mapping-test-explorer__item__actions">
1189
+ <button
1190
+ className="mapping-test-explorer__item__action mapping-test-explorer__run-test-btn"
1191
+ onClick={runSuite}
1192
+ disabled={isRunning}
1193
+ tabIndex={-1}
1194
+ title={`Run ${suite.id}`}
1195
+ >
1196
+ {<PlayIcon />}
1197
+ </button>
1198
+ </div>
1322
1199
  </button>
1323
1200
  </ContextMenu>
1324
1201
  );
@@ -1335,10 +1212,9 @@ export const MappingTestableEditor = observer(
1335
1212
  const isReadOnly = mappingEditorState.isReadOnly;
1336
1213
  const suites = mappingTestableState.mapping.tests;
1337
1214
  const selectedSuiteState = mappingTestableState.selectedTestSuite;
1338
- const addSuite = (): void =>
1339
- mappingTestableState.createSuiteState.setShowModal(true);
1215
+ const addSuite = (): void => mappingTestableState.openCreateModal();
1340
1216
  const runSuites = (): void => {
1341
- mappingTestableState.runAllSuites();
1217
+ mappingTestableState.runTestable();
1342
1218
  };
1343
1219
  const runFailingTests = (): void => {
1344
1220
  mappingTestableState.runAllFailingSuites();
@@ -1363,6 +1239,10 @@ export const MappingTestableEditor = observer(
1363
1239
  const renameTestingComponent = (val: string): void => {
1364
1240
  mappingTestableState.renameTestableComponent(val);
1365
1241
  };
1242
+
1243
+ useApplicationNavigationContext(
1244
+ LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.MAPPING_TEST_EDITOR,
1245
+ );
1366
1246
  return (
1367
1247
  <div className="service-test-suite-editor panel">
1368
1248
  <div className="service-test-suite-editor">
@@ -1439,8 +1319,10 @@ export const MappingTestableEditor = observer(
1439
1319
  </div>
1440
1320
  </ResizablePanel>
1441
1321
  </ResizablePanelGroup>
1442
- {mappingTestableState.createSuiteState.showModal && (
1443
- <CreateTestSuiteModal mappingTestableState={mappingTestableState} />
1322
+ {mappingTestableState.createSuiteState && (
1323
+ <CreateTestSuiteModal
1324
+ creatorState={mappingTestableState.createSuiteState}
1325
+ />
1444
1326
  )}
1445
1327
  {mappingTestableState.testableComponentToRename && (
1446
1328
  <RenameModal