Copilot commented on code in PR #6547: URL: https://github.com/apache/texera/pull/6547#discussion_r3611610348
########## frontend/src/app/common/util/workflow-check.spec.ts: ########## @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { checkIfWorkflowBroken } from "./workflow-check"; + +type WorkflowInput = Parameters<typeof checkIfWorkflowBroken>[0]; + +function createWorkflow( + operatorIDs: ReadonlyArray<string>, + links: ReadonlyArray<{ + sourceOperatorID: string; + targetOperatorID: string; + }> +): WorkflowInput { + return { + content: { + operators: operatorIDs.map(operatorID => ({ operatorID })), + links: links.map(({ sourceOperatorID, targetOperatorID }) => ({ + source: { operatorID: sourceOperatorID }, + target: { operatorID: targetOperatorID }, + })), + }, + } as unknown as WorkflowInput; +} Review Comment: Optional: avoid `as unknown as WorkflowInput` in this test helper—using an unsafe double-cast bypasses type-checking and can let the test drift from the real `Workflow`/`WorkflowContent` shape. Since `WorkflowMetadata` and `WorkflowContent` have manageable required fields, you can build a minimal but fully-typed workflow object (with stub operator/link fields) and remove the cast entirely. -- 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]
