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


##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-file-renderer/user-dataset-file-renderer.component.spec.ts:
##########
@@ -194,4 +194,45 @@ describe("UserDatasetFileRendererComponent", () => {
       expect(getMimeType("")).toBe(MIME_TYPES.OCTET_STREAM);
     });
   });
+
+  describe("file content loading", () => {
+    it("loadTabularFile sets the header and normalizes row lengths", () => {

Review Comment:
   This test name says it "normalizes row lengths", but the assertions show 
longer rows are kept longer than the header (only short rows are padded). 
Renaming the test makes the intended behavior clearer and avoids implying 
truncation to the header width.



##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-file-renderer/user-dataset-file-renderer.component.spec.ts:
##########
@@ -194,4 +194,45 @@ describe("UserDatasetFileRendererComponent", () => {
       expect(getMimeType("")).toBe(MIME_TYPES.OCTET_STREAM);
     });
   });
+
+  describe("file content loading", () => {
+    it("loadTabularFile sets the header and normalizes row lengths", () => {
+      (component as unknown as { loadTabularFile: (d: unknown[][]) => void 
}).loadTabularFile([
+        ["a", "b", "c"],
+        ["1", "2"],
+        ["x", "y", "z", "w"],
+      ]);
+
+      expect(component.tableDataHeader).toEqual(["a", "b", "c"]);
+      expect(component.tableContent[0]).toEqual(["1", "2", ""]); // short row 
padded to the header width
+      expect(component.tableContent[1]).toEqual(["x", "y", "z", "w"]);
+    });
+
+    it("loadTabularFile leaves state unchanged for empty data", () => {
+      component.tableDataHeader = ["keep"];
+      (component as unknown as { loadTabularFile: (d: unknown[][]) => void 
}).loadTabularFile([]);
+      expect(component.tableDataHeader).toEqual(["keep"]);
+    });

Review Comment:
   This test says it "leaves state unchanged" but only asserts on 
tableDataHeader. If tableContent (or other state) were accidentally reset, this 
test would still pass. Consider setting tableContent to a sentinel value and 
asserting it remains unchanged as well.



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