Copilot commented on code in PR #6540:
URL: https://github.com/apache/texera/pull/6540#discussion_r3609559039


##########
frontend/src/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts:
##########
@@ -60,4 +73,143 @@ describe("TimeTravelComponent", () => {
   it("should create", () => {
     expect(component).toBeTruthy();
   });
+
+  describe("extended method coverage", () => {
+    let executionsService: WorkflowExecutionsService;
+    let versionService: WorkflowVersionService;
+    let executeService: ExecuteWorkflowService;
+    let notificationService: NotificationService;

Review Comment:
   The component’s ngOnInit starts a timer(0, 5000) poller on 
fixture.detectChanges(). Since WorkflowActionService defaults to wid=0, this 
schedules an executions HTTP request in every test unless getWorkflowMetadata 
is stubbed before detectChanges.
   
   Right now the stub is only installed inside the nested describe, and the 
spec never calls HttpTestingController.verify(), so the "should create" test 
(and any others) can leave pending requests unnoticed.



##########
frontend/src/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts:
##########
@@ -60,4 +73,143 @@ describe("TimeTravelComponent", () => {
   it("should create", () => {
     expect(component).toBeTruthy();
   });
+
+  describe("extended method coverage", () => {
+    let executionsService: WorkflowExecutionsService;
+    let versionService: WorkflowVersionService;
+    let executeService: ExecuteWorkflowService;
+    let notificationService: NotificationService;
+    let httpMock: HttpTestingController;
+    let metadataSpy: ReturnType<typeof vi.spyOn>;
+
+    beforeEach(() => {
+      executionsService = TestBed.inject(WorkflowExecutionsService);
+      versionService = TestBed.inject(WorkflowVersionService);
+      executeService = TestBed.inject(ExecuteWorkflowService);
+      notificationService = TestBed.inject(NotificationService);
+      httpMock = TestBed.inject(HttpTestingController);
+      // Neutralize the ngOnInit 5s poller: with no wid its callback 
early-returns,
+      // so no stray executions request lands in httpMock.
+      metadataSpy = vi.spyOn(workflowActionService, 
"getWorkflowMetadata").mockReturnValue(undefined as any);
+    });
+
+    afterEach(() => {
+      vi.restoreAllMocks();
+    });

Review Comment:
   If getWorkflowMetadata is stubbed in the outer beforeEach (so it applies to 
all tests and prevents poller requests), this nested beforeEach should not call 
vi.spyOn(...) again (it will double-spy / overwrite). Reuse the existing spy 
instance instead, and rely on the outer afterEach for 
vi.restoreAllMocks()/HttpTestingController.verify().



-- 
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