Xiao-zhen-Liu commented on code in PR #5702:
URL: https://github.com/apache/texera/pull/5702#discussion_r3449993787


##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts:
##########
@@ -910,6 +910,22 @@ describe("WorkflowEditorComponent", () => {
 
         expect(getStroke(mockScanPredicate.operatorID)).toBe("red");
       });
+
+      it("uses the Validation passed in instead of recomputing it", () => {
+        // Let the validation chain settle from the operator-add so subsequent
+        // calls to validateOperator are isolated to the helper itself.
+        workflowActionService.addOperator(mockScanPredicate, mockPoint);
+        fixture.detectChanges();
+
+        const validateSpy = vi.spyOn(validationWorkflowService, 
"validateOperator").mockClear();
+
+        // Call the helper directly with a Validation argument, mirroring what
+        // the validation-stream subscriber does at runtime
+        // (handleOperatorValidation passes value.validation through).
+        (component as any).applyOperatorBorder(mockScanPredicate.operatorID, { 
isValid: true });

Review Comment:
   Optional: this proves the recompute is skipped, but not that the passed-in 
value is used. Passing `{ isValid: false }` and asserting the operator goes red 
would cover that too.



##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts:
##########
@@ -910,6 +910,22 @@ describe("WorkflowEditorComponent", () => {
 
         expect(getStroke(mockScanPredicate.operatorID)).toBe("red");
       });
+
+      it("uses the Validation passed in instead of recomputing it", () => {
+        // Let the validation chain settle from the operator-add so subsequent
+        // calls to validateOperator are isolated to the helper itself.
+        workflowActionService.addOperator(mockScanPredicate, mockPoint);
+        fixture.detectChanges();
+
+        const validateSpy = vi.spyOn(validationWorkflowService, 
"validateOperator").mockClear();

Review Comment:
   Minor: the spy is created after the `addOperator` calls above, so there's 
nothing to clear yet — `.mockClear()` is redundant here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to