Copilot commented on code in PR #7993:
URL: https://github.com/apache/texera/pull/7993#discussion_r3867575210
##########
frontend/src/app/workspace/service/workflow-result-export/workflow-result-export.service.spec.ts:
##########
@@ -320,6 +320,48 @@ describe("WorkflowResultExportService", () => {
expect(notificationServiceSpy.success).toHaveBeenCalledWith("Result
exported successfully");
});
+ it("errors without a dataset list when every operator is blocked but no
dataset was named", () => {
+ enableExport();
+ // The backend can mark an operator restricted while naming no dataset
labels for it,
+ // which leaves the message with nothing to append.
+ const download = stubDownloadService({ downloadability: { op1: [] } });
+ texeraGraphSpy.getAllOperators.mockReturnValue([{ operatorID: "op1" }]
as any);
+
+ service.exportWorkflowExecutionResult("csv", "wf", [1], 0, 0, "file",
true, "dataset", makeUnit());
+
+ expect(notificationServiceSpy.error).toHaveBeenCalledWith(
+ "Cannot export result: selection depends on dataset(s) that are not
downloadable"
+ );
+ expect(notificationServiceSpy.loading).not.toHaveBeenCalled();
+ expect(download.exportWorkflowResultToDataset).not.toHaveBeenCalled();
+ });
+
+ it("warns without a dataset list when only some operators are blocked and
no dataset was named", () => {
+ enableExport();
+ (notificationServiceSpy as any).warning = vi.fn();
+ const download = stubDownloadService({ downloadability: { op2: [] } });
Review Comment:
Avoid the `(notificationServiceSpy as any)` cast here. `NotificationService`
already defines `warning(...)`, so you can attach a spy with normal typing;
this keeps the test type-safe and avoids masking real API mismatches.
##########
frontend/src/app/dashboard/component/user/user-workflow/ngbd-modal-workflow-executions/workflow-runtime-statistics/workflow-runtime-statistics.component.spec.ts:
##########
@@ -272,4 +291,36 @@ describe("WorkflowRuntimeStatisticsComponent", () => {
expect(warnSpy).toHaveBeenCalledWith("No data available for the chart.");
expect(gd.data).toBeUndefined();
});
+
+ it("onTabChanged after a statistics-less init yields an empty dataset and
warns instead of plotting", async () => {
+ // ngOnInit bails out before groupedStatistics is ever assigned, but the
tabs still render,
+ // so a tab click reaches createDataset with no grouping in place.
+ await createFixture({ workflowRuntimeStatistics: undefined });
+ const gd = chartDiv();
+ fixture.detectChanges();
+
+ expect((component as unknown as { createDataset(i: number): Series[]
}).createDataset(3)).toEqual([]);
+
+ component.onTabChanged(3);
+
+ expect(warnSpy).toHaveBeenCalledWith("No data available for the chart.");
+ expect(gd.data).toBeUndefined();
+ });
+
+ it("createDataset falls back to the numberOfWorkers metric for an
out-of-range metric index", async () => {
+ await createFixture({ workflowRuntimeStatistics: validStats() });
+ const grouped = group();
+
+ // NOTE: the template renders exactly one nz-tab per metric key, so the
real UI never produces
+ // an out-of-range index. This pins a defensive default on the public
onTabChanged/createDataset
+ // contract, not a UI path.
Review Comment:
This comment says it pins the public `onTabChanged` contract too, but the
test only exercises `createDataset` via the helper `dataset(...)`. Either
adjust the wording or also assert the `onTabChanged(8)` behavior; otherwise the
comment overstates what is covered.
--
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]