@finos/legend-application-studio 28.14.1 → 28.14.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 (63) hide show
  1. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts +1 -1
  2. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts.map +1 -1
  3. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js +93 -14
  4. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js.map +1 -1
  5. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js +7 -1
  7. package/lib/components/editor/editor-group/service-editor/ServiceRegistrationEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts +1 -13
  9. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  10. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +7 -21
  11. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  12. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +12 -1
  13. package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
  14. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +13 -3
  15. package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
  16. package/lib/index.css +2 -2
  17. package/lib/index.css.map +1 -1
  18. package/lib/package.json +1 -1
  19. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts +34 -10
  20. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts.map +1 -1
  21. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +174 -95
  22. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -1
  23. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +1 -8
  24. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  25. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +1 -70
  26. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  27. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +1 -1
  28. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -1
  29. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +2 -4
  30. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts +2 -0
  32. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  33. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +6 -0
  34. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  35. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +0 -8
  36. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  37. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -73
  38. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  39. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +12 -2
  40. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
  41. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +120 -16
  42. package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
  43. package/lib/stores/editor/utils/TestableUtils.d.ts +7 -1
  44. package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
  45. package/lib/stores/editor/utils/TestableUtils.js +71 -2
  46. package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
  47. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts +6 -1
  48. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts.map +1 -1
  49. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js +16 -1
  50. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js.map +1 -1
  51. package/package.json +4 -4
  52. package/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx +376 -61
  53. package/src/components/editor/editor-group/service-editor/ServiceRegistrationEditor.tsx +38 -1
  54. package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +18 -92
  55. package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +74 -1
  56. package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +280 -131
  57. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +2 -94
  58. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +5 -5
  59. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +7 -0
  60. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +1 -143
  61. package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +159 -19
  62. package/src/stores/editor/utils/TestableUtils.ts +144 -4
  63. package/src/stores/graph-modifier/DomainGraphModifierHelper.ts +33 -0
@@ -21,27 +21,29 @@ import {
21
21
  assertErrorThrown,
22
22
  isNonNullable,
23
23
  uuid,
24
- type GeneratorFn,
25
24
  LogEvent,
26
25
  guaranteeNonNullable,
27
26
  addUniqueEntry,
28
27
  uniq,
29
28
  assertTrue,
30
29
  guaranteeType,
30
+ returnUndefOnError,
31
+ type PlainObject,
32
+ filterByType,
33
+ deleteEntry,
31
34
  } from '@finos/legend-shared';
32
35
  import {
33
36
  type ConcreteFunctionDefinition,
34
37
  type EmbeddedData,
35
- type TestResult,
36
38
  type AtomicTest,
37
39
  type EngineRuntime,
38
40
  type ObserverContext,
39
41
  type ValueSpecification,
42
+ FunctionParameterValue,
43
+ VariableExpression,
40
44
  FunctionTest,
41
- UniqueTestId,
42
45
  FunctionStoreTestData,
43
46
  FunctionTestSuite,
44
- RunTestsTestableInput,
45
47
  RawLambda,
46
48
  PackageableRuntime,
47
49
  SimpleFunctionExpression,
@@ -53,6 +55,8 @@ import {
53
55
  Database,
54
56
  RelationalCSVData,
55
57
  PackageableElementExplicitReference,
58
+ observe_ValueSpecification,
59
+ buildLambdaVariableExpressions,
56
60
  } from '@finos/legend-graph';
57
61
  import {
58
62
  TestablePackageableElementEditorState,
@@ -63,15 +67,20 @@ import { EmbeddedDataEditorState } from '../../data/DataEditorState.js';
63
67
  import {
64
68
  functionTestable_deleteDataStore,
65
69
  functionTestable_setEmbeddedData,
70
+ function_addParameterValue,
66
71
  function_addTestSuite,
72
+ function_deleteParameterValue,
73
+ function_setParameterName,
74
+ function_setParameterValueSpec,
75
+ function_setParameterValues,
67
76
  } from '../../../../../graph-modifier/DomainGraphModifierHelper.js';
68
77
  import {
69
78
  DEFAULT_TEST_ASSERTION_ID,
70
79
  createDefaultEqualToJSONTestAssertion,
71
- isTestPassing,
72
80
  } from '../../../../utils/TestableUtils.js';
73
81
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../../../__lib__/LegendStudioEvent.js';
74
82
  import { testSuite_addTest } from '../../../../../graph-modifier/Testable_GraphModifierHelper.js';
83
+ import { generateVariableExpressionMockValue } from '@finos/legend-query-builder';
75
84
 
76
85
  const addToFunctionMap = (
77
86
  val: SimpleFunctionExpression,
@@ -202,12 +211,86 @@ export class FunctionStoreTestDataState {
202
211
  }
203
212
  }
204
213
 
214
+ export class FunctionTestParameterState {
215
+ readonly uuid = uuid();
216
+ readonly editorStore: EditorStore;
217
+ readonly testState: FunctionTestState;
218
+ parameterValue: FunctionParameterValue;
219
+ constructor(
220
+ parameterValue: FunctionParameterValue,
221
+ editorStore: EditorStore,
222
+ testState: FunctionTestState,
223
+ ) {
224
+ this.editorStore = editorStore;
225
+ this.testState = testState;
226
+ this.parameterValue = parameterValue;
227
+ }
228
+ }
229
+
230
+ export class FunctionValueSpecificationTestParameterState extends FunctionTestParameterState {
231
+ valueSpec: ValueSpecification;
232
+ varExpression: VariableExpression;
233
+
234
+ constructor(
235
+ parameterValue: FunctionParameterValue,
236
+ editorStore: EditorStore,
237
+ testState: FunctionTestState,
238
+ valueSpec: ValueSpecification,
239
+ varExpression: VariableExpression,
240
+ ) {
241
+ super(parameterValue, editorStore, testState);
242
+ makeObservable(this, {
243
+ setName: observable,
244
+ valueSpec: observable,
245
+ parameterValue: observable,
246
+ resetValueSpec: action,
247
+ updateValueSpecification: action,
248
+ updateParameterValue: action,
249
+ });
250
+ this.valueSpec = valueSpec;
251
+ this.varExpression = varExpression;
252
+ }
253
+
254
+ updateValueSpecification(val: ValueSpecification): void {
255
+ this.valueSpec = observe_ValueSpecification(
256
+ val,
257
+ this.editorStore.changeDetectionState.observerContext,
258
+ );
259
+ this.updateParameterValue();
260
+ }
261
+
262
+ updateParameterValue(): void {
263
+ const updatedValueSpec =
264
+ this.editorStore.graphManagerState.graphManager.serializeValueSpecification(
265
+ this.valueSpec,
266
+ );
267
+ function_setParameterValueSpec(this.parameterValue, updatedValueSpec);
268
+ }
269
+
270
+ setName(val: string): void {
271
+ function_setParameterName(this.parameterValue, val);
272
+ }
273
+
274
+ resetValueSpec(): void {
275
+ const mockValue = generateVariableExpressionMockValue(
276
+ this.varExpression,
277
+ this.editorStore.graphManagerState.graph,
278
+ this.editorStore.changeDetectionState.observerContext,
279
+ );
280
+ if (mockValue) {
281
+ this.updateValueSpecification(mockValue);
282
+ }
283
+ }
284
+ }
285
+
205
286
  export class FunctionTestState extends TestableTestEditorState {
206
287
  readonly parentState: FunctionTestSuiteState;
207
288
  readonly functionTestableState: FunctionTestableState;
208
289
  readonly uuid = uuid();
209
290
  override test: FunctionTest;
210
- // TODO: param
291
+ parameterValueStates: FunctionTestParameterState[] = [];
292
+ newParameterValueName = '';
293
+ showNewParameterModal = false;
211
294
 
212
295
  constructor(
213
296
  editorStore: EditorStore,
@@ -227,7 +310,13 @@ export class FunctionTestState extends TestableTestEditorState {
227
310
  assertionEditorStates: observable,
228
311
  testResultState: observable,
229
312
  runningTestAction: observable,
313
+ parameterValueStates: observable,
314
+ setNewParameterValueName: action,
315
+ setShowNewParameterModal: action,
316
+ addExpressionParameterValue: action,
317
+ openNewParamModal: action,
230
318
  addAssertion: action,
319
+ addParameterValue: action,
231
320
  setAssertionToRename: action,
232
321
  handleTestResult: action,
233
322
  setSelectedTab: action,
@@ -236,6 +325,188 @@ export class FunctionTestState extends TestableTestEditorState {
236
325
  this.parentState = parentSuiteState;
237
326
  this.functionTestableState = parentSuiteState.functionTestableState;
238
327
  this.test = test;
328
+ this.parameterValueStates = this.buildParameterStates();
329
+ }
330
+ get queryVariableExpressions(): VariableExpression[] {
331
+ const query =
332
+ this.functionTestableState.functionEditorState.bodyExpressionSequence;
333
+ return buildLambdaVariableExpressions(
334
+ query,
335
+ this.editorStore.graphManagerState,
336
+ ).filter(filterByType(VariableExpression));
337
+ }
338
+
339
+ get newParamOptions(): { value: string; label: string }[] {
340
+ const queryVarExpressions = this.queryVariableExpressions;
341
+ const currentParams = this.test.parameters ?? [];
342
+ return queryVarExpressions
343
+ .filter((v) => !currentParams.find((i) => i.name === v.name))
344
+ .map((e) => ({ value: e.name, label: e.name }));
345
+ }
346
+
347
+ setNewParameterValueName(val: string): void {
348
+ this.newParameterValueName = val;
349
+ }
350
+
351
+ setShowNewParameterModal(val: boolean): void {
352
+ this.showNewParameterModal = val;
353
+ }
354
+
355
+ openNewParamModal(): void {
356
+ this.setShowNewParameterModal(true);
357
+ const option = this.newParamOptions[0];
358
+ if (option) {
359
+ this.newParameterValueName = option.value;
360
+ }
361
+ }
362
+
363
+ addParameterValue(): void {
364
+ try {
365
+ const expressions = this.queryVariableExpressions;
366
+ const expression = guaranteeNonNullable(
367
+ expressions.find((v) => v.name === this.newParameterValueName),
368
+ );
369
+ this.addExpressionParameterValue(expression);
370
+ } catch (error) {
371
+ assertErrorThrown(error);
372
+ this.editorStore.applicationStore.notificationService.notifyError(error);
373
+ } finally {
374
+ this.setShowNewParameterModal(false);
375
+ }
376
+ }
377
+
378
+ syncWithQuery(): void {
379
+ // remove non existing params
380
+ this.parameterValueStates.forEach((paramState) => {
381
+ const expression = this.queryVariableExpressions.find(
382
+ (v) => v.name === paramState.parameterValue.name,
383
+ );
384
+ if (!expression) {
385
+ deleteEntry(this.parameterValueStates, paramState);
386
+ function_deleteParameterValue(this.test, paramState.parameterValue);
387
+ }
388
+ });
389
+ // add new required params
390
+ this.queryVariableExpressions.forEach((v) => {
391
+ const multiplicity = v.multiplicity;
392
+ const isRequired = multiplicity.lowerBound > 0;
393
+ const paramState = this.parameterValueStates.find(
394
+ (p) => p.parameterValue.name === v.name,
395
+ );
396
+ if (!paramState && isRequired) {
397
+ this.addExpressionParameterValue(v);
398
+ }
399
+ });
400
+ }
401
+
402
+ addExpressionParameterValue(expression: VariableExpression): void {
403
+ try {
404
+ const mockValue = guaranteeNonNullable(
405
+ generateVariableExpressionMockValue(
406
+ expression,
407
+ this.editorStore.graphManagerState.graph,
408
+ this.editorStore.changeDetectionState.observerContext,
409
+ ),
410
+ );
411
+ const paramValue = new FunctionParameterValue();
412
+ paramValue.name = expression.name;
413
+ paramValue.value =
414
+ this.editorStore.graphManagerState.graphManager.serializeValueSpecification(
415
+ mockValue,
416
+ );
417
+ function_addParameterValue(this.test, paramValue);
418
+ const paramValueState = new FunctionValueSpecificationTestParameterState(
419
+ paramValue,
420
+ this.editorStore,
421
+ this,
422
+ observe_ValueSpecification(
423
+ mockValue,
424
+ this.editorStore.changeDetectionState.observerContext,
425
+ ),
426
+ expression,
427
+ );
428
+ this.parameterValueStates.push(paramValueState);
429
+ } catch (error) {
430
+ assertErrorThrown(error);
431
+ this.editorStore.applicationStore.notificationService.notifyError(error);
432
+ }
433
+ }
434
+
435
+ generateTestParameterValues(): void {
436
+ try {
437
+ const varExpressions = this.queryVariableExpressions;
438
+ const parameterValueStates = varExpressions
439
+ .map((varExpression) => {
440
+ const mockValue = generateVariableExpressionMockValue(
441
+ varExpression,
442
+ this.editorStore.graphManagerState.graph,
443
+ this.editorStore.changeDetectionState.observerContext,
444
+ );
445
+ if (mockValue) {
446
+ const paramValue = new FunctionParameterValue();
447
+ paramValue.name = varExpression.name;
448
+ paramValue.value =
449
+ this.editorStore.graphManagerState.graphManager.serializeValueSpecification(
450
+ mockValue,
451
+ );
452
+ return new FunctionValueSpecificationTestParameterState(
453
+ paramValue,
454
+ this.editorStore,
455
+ this,
456
+ mockValue,
457
+ varExpression,
458
+ );
459
+ }
460
+ return undefined;
461
+ })
462
+ .filter(isNonNullable);
463
+ function_setParameterValues(
464
+ this.test,
465
+ parameterValueStates.map((s) => s.parameterValue),
466
+ );
467
+ this.parameterValueStates = parameterValueStates;
468
+ } catch (error) {
469
+ assertErrorThrown(error);
470
+ this.editorStore.applicationStore.notificationService.notifyError(
471
+ `Unable to generate param values: ${error.message}`,
472
+ );
473
+ }
474
+ }
475
+
476
+ buildParameterStates(): FunctionTestParameterState[] {
477
+ const query =
478
+ this.functionTestableState.functionEditorState.bodyExpressionSequence;
479
+ const varExpressions = buildLambdaVariableExpressions(
480
+ query,
481
+ this.editorStore.graphManagerState,
482
+ ).filter(filterByType(VariableExpression));
483
+ const paramValues = this.test.parameters ?? [];
484
+ return paramValues.map((pValue) => {
485
+ const spec = returnUndefOnError(() =>
486
+ this.editorStore.graphManagerState.graphManager.buildValueSpecification(
487
+ pValue.value as PlainObject,
488
+ this.editorStore.graphManagerState.graph,
489
+ ),
490
+ );
491
+ const expression = varExpressions.find((e) => e.name === pValue.name);
492
+ return spec && expression
493
+ ? new FunctionValueSpecificationTestParameterState(
494
+ pValue,
495
+ this.editorStore,
496
+ this,
497
+ observe_ValueSpecification(
498
+ spec,
499
+ this.editorStore.changeDetectionState.observerContext,
500
+ ),
501
+ expression,
502
+ )
503
+ : new FunctionTestParameterState(pValue, this.editorStore, this);
504
+ });
505
+ }
506
+
507
+ removeParamValueState(paramState: FunctionTestParameterState): void {
508
+ deleteEntry(this.parameterValueStates, paramState);
509
+ function_deleteParameterValue(this.test, paramState.parameterValue);
239
510
  }
240
511
  }
241
512
 
@@ -395,8 +666,8 @@ export class FunctionTestSuiteState extends TestableTestSuiteEditorState {
395
666
  export class FunctionTestableState extends TestablePackageableElementEditorState {
396
667
  readonly functionEditorState: FunctionEditorState;
397
668
  declare selectedTestSuite: FunctionTestSuiteState | undefined;
669
+ declare runningSuite: FunctionTestSuite | undefined;
398
670
 
399
- runningSuite: FunctionTestSuite | undefined;
400
671
  createSuiteModal = false;
401
672
 
402
673
  constructor(functionEditorState: FunctionEditorState) {
@@ -407,6 +678,7 @@ export class FunctionTestableState extends TestablePackageableElementEditorState
407
678
  selectedTestSuite: observable,
408
679
  testableResults: observable,
409
680
  runningSuite: observable,
681
+ testableComponentToRename: observable,
410
682
  createSuiteModal: observable,
411
683
  init: action,
412
684
  buildTestSuiteState: action,
@@ -428,41 +700,7 @@ export class FunctionTestableState extends TestablePackageableElementEditorState
428
700
  return this.functionEditorState.functionElement;
429
701
  }
430
702
 
431
- get passingSuites(): FunctionTestSuite[] {
432
- const results = this.testableResults;
433
- if (results?.length) {
434
- return this.function.tests.filter((suite) =>
435
- results
436
- .filter((res) => res.parentSuite?.id === suite.id)
437
- .every((e) => isTestPassing(e)),
438
- );
439
- }
440
- return [];
441
- }
442
-
443
- get failingSuites(): FunctionTestSuite[] {
444
- const results = this.testableResults;
445
- if (results?.length) {
446
- return this.function.tests.filter((suite) =>
447
- results
448
- .filter((res) => res.parentSuite?.id === suite.id)
449
- .some((e) => !isTestPassing(e)),
450
- );
451
- }
452
- return [];
453
- }
454
-
455
- get staticSuites(): FunctionTestSuite[] {
456
- const results = this.testableResults;
457
- if (results?.length) {
458
- return this.function.tests.filter((suite) =>
459
- results.every((res) => res.parentSuite?.id !== suite.id),
460
- );
461
- }
462
- return this.function.tests;
463
- }
464
-
465
- init(): void {
703
+ override init(): void {
466
704
  if (!this.selectedTestSuite) {
467
705
  const suite = this.function.tests[0];
468
706
  this.selectedTestSuite = suite
@@ -545,95 +783,6 @@ export class FunctionTestableState extends TestablePackageableElementEditorState
545
783
  this.setCreateSuite(false);
546
784
  }
547
785
 
548
- *runSuite(suite: FunctionTestSuite): GeneratorFn<void> {
549
- try {
550
- this.runningSuite = suite;
551
- this.clearTestResultsForSuite(suite);
552
- this.selectedTestSuite?.testStates.forEach((t) => t.resetResult());
553
- this.selectedTestSuite?.testStates.forEach((t) =>
554
- t.runningTestAction.inProgress(),
555
- );
556
-
557
- const input = new RunTestsTestableInput(this.function);
558
- suite.tests.forEach((t) =>
559
- input.unitTestIds.push(new UniqueTestId(suite, t)),
560
- );
561
- const testResults =
562
- (yield this.editorStore.graphManagerState.graphManager.runTests(
563
- [input],
564
- this.editorStore.graphManagerState.graph,
565
- )) as TestResult[];
566
-
567
- this.handleNewResults(testResults);
568
- } catch (error) {
569
- assertErrorThrown(error);
570
- this.editorStore.applicationStore.notificationService.notifyError(error);
571
- this.isRunningTestableSuitesState.fail();
572
- } finally {
573
- this.selectedTestSuite?.testStates.forEach((t) =>
574
- t.runningTestAction.complete(),
575
- );
576
- this.runningSuite = undefined;
577
- }
578
- }
579
-
580
- *runAllFailingSuites(): GeneratorFn<void> {
581
- try {
582
- this.isRunningFailingSuitesState.inProgress();
583
- const input = new RunTestsTestableInput(this.testable);
584
- this.failingSuites.forEach((s) => {
585
- s.tests.forEach((t) => input.unitTestIds.push(new UniqueTestId(s, t)));
586
- });
587
- const testResults =
588
- (yield this.editorStore.graphManagerState.graphManager.runTests(
589
- [input],
590
- this.editorStore.graphManagerState.graph,
591
- )) as TestResult[];
592
- this.handleNewResults(testResults);
593
- this.isRunningFailingSuitesState.complete();
594
- } catch (error) {
595
- assertErrorThrown(error);
596
- this.editorStore.applicationStore.notificationService.notifyError(error);
597
- this.isRunningFailingSuitesState.fail();
598
- } finally {
599
- this.selectedTestSuite?.testStates.forEach((t) =>
600
- t.runningTestAction.complete(),
601
- );
602
- }
603
- }
604
-
605
- handleNewResults(results: TestResult[]): void {
606
- if (this.testableResults?.length) {
607
- const newSuitesResults = results
608
- .map((e) => e.parentSuite?.id)
609
- .filter(isNonNullable);
610
- const reducedFilters = this.testableResults.filter(
611
- (res) => !newSuitesResults.includes(res.parentSuite?.id ?? ''),
612
- );
613
- this.setTestableResults([...reducedFilters, ...results]);
614
- } else {
615
- this.setTestableResults(results);
616
- }
617
- this.testableResults?.forEach((result) => {
618
- const state = this.selectedTestSuite?.testStates.find(
619
- (t) =>
620
- t.test.id === result.atomicTest.id &&
621
- t.parentState.suite.id === result.parentSuite?.id,
622
- );
623
- state?.handleTestResult(result);
624
- });
625
- }
626
-
627
- clearTestResultsForSuite(suite: FunctionTestSuite): void {
628
- this.testableResults = this.testableResults?.filter(
629
- (t) => !(this.resolveSuiteResults(suite) ?? []).includes(t),
630
- );
631
- }
632
-
633
- resolveSuiteResults(suite: FunctionTestSuite): TestResult[] | undefined {
634
- return this.testableResults?.filter((t) => t.parentSuite?.id === suite.id);
635
- }
636
-
637
786
  buildTestSuiteState(val: FunctionTestSuite): FunctionTestSuiteState {
638
787
  return new FunctionTestSuiteState(this.editorStore, this, val);
639
788
  }
@@ -68,7 +68,6 @@ import {
68
68
  import {
69
69
  EmbeddedDataCreatorFromEmbeddedData,
70
70
  createBareExternalFormat,
71
- isTestPassing,
72
71
  } from '../../../../utils/TestableUtils.js';
73
72
  import {
74
73
  TESTABLE_TEST_TAB,
@@ -542,7 +541,7 @@ export class MappingTestableState extends TestablePackageableElementEditorState
542
541
  createSuiteState: CreateSuiteState | undefined;
543
542
 
544
543
  declare selectedTestSuite: MappingTestSuiteState | undefined;
545
- runningSuite: MappingTestSuite | undefined;
544
+ declare runningSuite: MappingTestSuite | undefined;
546
545
 
547
546
  constructor(mappingEditorState: MappingEditorState) {
548
547
  super(mappingEditorState, mappingEditorState.mapping);
@@ -575,50 +574,6 @@ export class MappingTestableState extends TestablePackageableElementEditorState
575
574
  return this.mappingEditorState.mapping;
576
575
  }
577
576
 
578
- get passingSuites(): MappingTestSuite[] {
579
- const results = this.testableResults;
580
- if (results?.length) {
581
- return this.mapping.tests.filter((suite) =>
582
- results
583
- .filter((res) => res.parentSuite?.id === suite.id)
584
- .every((e) => isTestPassing(e)),
585
- );
586
- }
587
- return [];
588
- }
589
-
590
- get failingSuites(): MappingTestSuite[] {
591
- const results = this.testableResults;
592
- if (results?.length) {
593
- return this.mapping.tests.filter((suite) =>
594
- results
595
- .filter((res) => res.parentSuite?.id === suite.id)
596
- .some((e) => !isTestPassing(e)),
597
- );
598
- }
599
- return [];
600
- }
601
-
602
- get staticSuites(): MappingTestSuite[] {
603
- const results = this.testableResults;
604
- if (results?.length) {
605
- return this.mapping.tests.filter((suite) =>
606
- results.every((res) => res.parentSuite?.id !== suite.id),
607
- );
608
- }
609
- return this.mapping.tests;
610
- }
611
-
612
- resolveSuiteResults(suite: MappingTestSuite): TestResult[] | undefined {
613
- return this.testableResults?.filter((t) => t.parentSuite?.id === suite.id);
614
- }
615
-
616
- clearTestResultsForSuite(suite: MappingTestSuite): void {
617
- this.testableResults = this.testableResults?.filter(
618
- (t) => !(this.resolveSuiteResults(suite) ?? []).includes(t),
619
- );
620
- }
621
-
622
577
  override init(): void {
623
578
  if (!this.selectedTestSuite) {
624
579
  const suite = this.mapping.tests[0];
@@ -668,7 +623,7 @@ export class MappingTestableState extends TestablePackageableElementEditorState
668
623
  }
669
624
  }
670
625
 
671
- *runSuite(suite: MappingTestSuite): GeneratorFn<void> {
626
+ override *runSuite(suite: MappingTestSuite): GeneratorFn<void> {
672
627
  try {
673
628
  this.runningSuite = suite;
674
629
  this.clearTestResultsForSuite(suite);
@@ -718,51 +673,4 @@ export class MappingTestableState extends TestablePackageableElementEditorState
718
673
  this.runningSuite = undefined;
719
674
  }
720
675
  }
721
-
722
- *runAllFailingSuites(): GeneratorFn<void> {
723
- try {
724
- this.isRunningFailingSuitesState.inProgress();
725
- const input = new RunTestsTestableInput(this.mapping);
726
- this.failingSuites.forEach((s) => {
727
- s.tests.forEach((t) => input.unitTestIds.push(new UniqueTestId(s, t)));
728
- });
729
- const testResults =
730
- (yield this.editorStore.graphManagerState.graphManager.runTests(
731
- [input],
732
- this.editorStore.graphManagerState.graph,
733
- )) as TestResult[];
734
- this.handleNewResults(testResults);
735
- this.isRunningFailingSuitesState.complete();
736
- } catch (error) {
737
- assertErrorThrown(error);
738
- this.editorStore.applicationStore.notificationService.notifyError(error);
739
- this.isRunningFailingSuitesState.fail();
740
- } finally {
741
- this.selectedTestSuite?.testStates.forEach((t) =>
742
- t.runningTestAction.complete(),
743
- );
744
- }
745
- }
746
-
747
- handleNewResults(results: TestResult[]): void {
748
- if (this.testableResults?.length) {
749
- const newSuitesResults = results
750
- .map((e) => e.parentSuite?.id)
751
- .filter(isNonNullable);
752
- const reducedFilters = this.testableResults.filter(
753
- (res) => !newSuitesResults.includes(res.parentSuite?.id ?? ''),
754
- );
755
- this.setTestableResults([...reducedFilters, ...results]);
756
- } else {
757
- this.setTestableResults(results);
758
- }
759
- this.testableResults?.forEach((result) => {
760
- const state = this.selectedTestSuite?.testStates.find(
761
- (t) =>
762
- t.test.id === result.atomicTest.id &&
763
- t.parentState.suite.id === result.parentSuite?.id,
764
- );
765
- state?.handleTestResult(result);
766
- });
767
- }
768
676
  }
@@ -184,7 +184,7 @@ export const createBareMappingTest = (
184
184
  id: string,
185
185
  storeTestData: StoreTestData | undefined,
186
186
  observerContext: ObserverContext,
187
- suite?: MappingTestSuite | undefined,
187
+ suite: MappingTestSuite,
188
188
  ): MappingTest => {
189
189
  const mappingTest = new MappingTest();
190
190
  mappingTest.id = id;
@@ -192,10 +192,10 @@ export const createBareMappingTest = (
192
192
  mappingTest.assertions = [
193
193
  createDefaultEqualToJSONTestAssertion(DEFAULT_TEST_ASSERTION_ID),
194
194
  ];
195
- if (suite) {
196
- mappingTest.__parent = suite;
197
- testSuite_addTest(suite, mappingTest, observerContext);
198
- }
195
+
196
+ mappingTest.__parent = suite;
197
+ testSuite_addTest(suite, mappingTest, observerContext);
198
+
199
199
  const assertion = createDefaultEqualToJSONTestAssertion(`expectedAssertion`);
200
200
  mappingTest.assertions = [assertion];
201
201
  assertion.parentTest = mappingTest;
@@ -99,6 +99,7 @@ export class ServiceConfigState {
99
99
  enableModesWithVersioning: boolean;
100
100
  TEMPORARY__useStoreModel = false;
101
101
  TEMPORARY__useGenerateLineage = true;
102
+ TEMPORARY__useGenerateOpenApi = false;
102
103
 
103
104
  constructor(
104
105
  editorStore: EditorStore,
@@ -112,6 +113,7 @@ export class ServiceConfigState {
112
113
  enableModesWithVersioning: observable,
113
114
  TEMPORARY__useStoreModel: observable,
114
115
  TEMPORARY__useGenerateLineage: observable,
116
+ TEMPORARY__useGenerateOpenApi: observable,
115
117
  executionModes: computed,
116
118
  options: computed,
117
119
  versionOptions: computed,
@@ -220,6 +222,10 @@ export class ServiceConfigState {
220
222
  this.TEMPORARY__useGenerateLineage = val;
221
223
  }
222
224
 
225
+ setUseGenerateOpenApi(val: boolean): void {
226
+ this.TEMPORARY__useGenerateOpenApi = val;
227
+ }
228
+
223
229
  initialize(): void {
224
230
  this.serviceEnv = getNullableFirstEntry(this.registrationOptions)?.env;
225
231
  this.serviceExecutionMode = this.executionModes[0];
@@ -296,6 +302,7 @@ export class ServiceRegistrationState extends ServiceConfigState {
296
302
  {
297
303
  TEMPORARY__useStoreModel: this.TEMPORARY__useStoreModel,
298
304
  TEMPORARY__useGenerateLineage: this.TEMPORARY__useGenerateLineage,
305
+ TEMPORARY__useGenerateOpenApi: this.TEMPORARY__useGenerateOpenApi,
299
306
  },
300
307
  )) as ServiceRegistrationSuccess;
301
308
  if (this.activatePostRegistration) {