This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-6758-601f7f84c83e309376de6f8cfd6cbb95199144a2
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 29145fe6d31eaa64011c8569968fe30f88dafad1
Author: Meng Wang <[email protected]>
AuthorDate: Tue Jul 21 22:42:56 2026 -0700

    test(frontend): cover DatasetDetailComponent upload-status, version-node 
selection, and trackByTask (#6758)
    
    ### What changes were proposed in this PR?
    
    Extends the existing `DatasetDetailComponent` spec to cover a few
    untested
    methods
    
    
(`frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts`).
    
    > Note: most of the methods the issue lists are already covered by the
    existing
    > spec. `removeFromPendingQueue` / `refreshPendingChanges` are `private`
    and are
    > exercised indirectly through the upload/handler flows, so this PR
    focuses on
    > the remaining public gaps.
    
    3 tests cover:
    
    - `getUploadStatus` — maps the multipart upload status to a progress
    state (`active` / `exception` / `success`).
    - `onVersionFileTreeNodeSelected` — loads the selected node's content.
    - `trackByTask` — returns the task's file path.
    
    No production code was changed.
    
    ### Any related issues, documentation, discussions?
    
    Closes #6747
    
    ### How was this PR tested?
    
    Extended unit tests, run locally in `frontend/` (all green; the failure
    path was
    verified by breaking an assertion to confirm the suite goes red):
    
    ```
    ng test --watch=false --include 
src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
    # Test Files 1 passed (1) | Tests 63 passed (63)
    prettier --write <spec>   # clean
    eslint  <spec>            # clean
    ```
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Opus 4.8 [1M context])
---
 .../dataset-detail.component.spec.ts               | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git 
a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
 
b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
index f5ebba48ac..91d8acce94 100644
--- 
a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
+++ 
b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
@@ -1008,4 +1008,32 @@ describe("DatasetDetailComponent behavior", () => {
       expect(notificationServiceStub.error).toHaveBeenCalledWith("Failed to 
copy file path");
     });
   });
+
+  describe("upload status, version-node selection, and trackBy", () => {
+    it("getUploadStatus maps the upload status to a progress state", () => {
+      expect(component.getUploadStatus("uploading")).toBe("active");
+      expect(component.getUploadStatus("initializing")).toBe("active");
+      expect(component.getUploadStatus("aborted")).toBe("exception");
+      expect(component.getUploadStatus("failed")).toBe("exception");
+      expect(component.getUploadStatus("finished")).toBe("success");
+    });
+
+    it("onVersionFileTreeNodeSelected loads the selected node's content", () 
=> {
+      const node = { name: "file.csv", type: "file" } as unknown as Parameters<
+        typeof component.onVersionFileTreeNodeSelected
+      >[0];
+      const loadSpy = vi
+        .spyOn(component as unknown as { loadFileContent: (n: unknown) => void 
}, "loadFileContent")
+        .mockImplementation(() => {});
+
+      component.onVersionFileTreeNodeSelected(node);
+
+      expect(loadSpy).toHaveBeenCalledWith(node);
+    });
+
+    it("trackByTask returns the task's file path", () => {
+      const task = { filePath: "owner/data/file.csv" } as unknown as 
Parameters<typeof component.trackByTask>[1];
+      expect(component.trackByTask(0, task)).toBe("owner/data/file.csv");
+    });
+  });
 });

Reply via email to