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


##########
frontend/src/app/workspace/component/hugging-face/hugging-face.component.spec.ts:
##########
@@ -1618,4 +1618,45 @@ describe("HuggingFaceComponent (TestBed)", () => {
       
expect(fixture.debugElement.query(By.css("div.alert-danger"))).toBeNull();
     });
   });
+
+  /*
+   * The half-taken arms left on this component: a teardown with nothing 
pending, the fallback
+   * used when the form has no task selected, and a snapshot that does not 
carry every key.
+   */
+  describe("remaining guards", () => {
+    it("clears no timeout when initialization already finished", () => {
+      const clearSpy = vi.spyOn(globalThis, "clearTimeout");
+      (component as any).initTimeout = null;
+
+      component.ngOnDestroy();
+
+      // The interval teardown may still call clearInterval; only the timeout 
arm is asserted.
+      expect(clearSpy).not.toHaveBeenCalled();
+    });

Review Comment:
   `vi.spyOn(globalThis, "clearTimeout")` is never restored, so this global spy 
can leak into other test files (this suite's `afterEach` does not call 
`vi.restoreAllMocks()`). Restoring the spy inside the test keeps isolation 
deterministic.



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