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


##########
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:
   Valid — that suite's shared `afterEach` only destroys the fixture and 
verifies HTTP, so the `clearTimeout` spy would have stayed installed for the 
rest of the file.
   
   The block now has its own `afterEach(() => vi.restoreAllMocks())`, which 
also covers the component spies the other two tests install. Verified it 
actually restores: a temporary assertion after the block showed 
`vi.isMockFunction(globalThis.clearTimeout)` is `false`.



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