You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "mengw15 (via GitHub)" <gi...@apache.org> on 2026/07/22 04:38:46 UTC

[PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

mengw15 opened a new pull request, #6759:
URL: https://github.com/apache/texera/pull/6759

   ### What changes were proposed in this PR?
   
   Extends the existing `UserDatasetFileRendererComponent` spec to cover the two
   file-content methods it had left untested
   (`frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-file-renderer/user-dataset-file-renderer.component.ts`).
   
   3 tests cover:
   
   - `loadTabularFile` — sets the header from the first row and normalizes each row's length to the header width; leaves state unchanged for empty data.
   - `readFileAsText` — reads the blob text into `textContent`.
   
   Per the issue's flaky-test note, `FileReader` is **not** left to jsdom's real
   async: it is replaced with a deterministic stub whose `readAsText` fires `onload`
   on a microtask (`queueMicrotask`, awaited via `Promise.resolve()`), and the
   global is restored in a `finally` so it survives an assertion failure. No
   production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6748
   
   ### 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/user-dataset-file-renderer/user-dataset-file-renderer.component.spec.ts
   # Test Files 1 passed (1) | Tests 18 passed (18)
   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])
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6759:
URL: https://github.com/apache/texera/pull/6759#issuecomment-5041918712

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - **Contributors with relevant context:** `@Ma77Ball`
     You can notify them by mentioning `@Ma77Ball` in a comment.
   


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 commented on code in PR #6759:
URL: https://github.com/apache/texera/pull/6759#discussion_r3627679406


##########
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:
   Renamed to state the behavior explicitly — short rows are padded to the header width and longer rows are kept intact (no truncation to the header).



##########
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:
   Added a `tableContent` sentinel (`[["keep-content"]]`) and now assert it stays unchanged too, so the test fails if empty data ever resets the content (verified).



-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6759:
URL: https://github.com/apache/texera/pull/6759#issuecomment-5042647286

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/6759?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 74.94%. Comparing base ([`3da5f49`](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`cd6adac`](https://app.codecov.io/gh/apache/texera/commit/cd6adacbf35201cf186a670a26d9c2fae706fddd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on main.
   :white_check_mark: All tests successful. No failed tests found.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##               main    #6759   +/-   ##
   =========================================
     Coverage     74.94%   74.94%           
     Complexity     3446     3446           
   =========================================
     Files          1160     1160           
     Lines         45798    45798           
     Branches       5071     5071           
   =========================================
     Hits          34324    34324           
     Misses         9828     9828           
     Partials       1646     1646           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.76% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.18% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `20.49% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.66% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.21% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.82% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.94% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `92.15% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/6759/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.14% <ø> (ø)` | | Carriedforward from [3da5f49](https://app.codecov.io/gh/apache/texera/commit/3da5f49c0a3727b1b57756265e84a5957551c036?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/6759?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan closed pull request #6759: test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText
URL: https://github.com/apache/texera/pull/6759


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): cover UserDatasetFileRendererComponent loadTabularFile and readFileAsText [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #6759:
URL: https://github.com/apache/texera/pull/6759


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org