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/18 22:59:46 UTC
[PR] test(frontend): add unit test coverage for DatasetSelectionModalComponent [texera]
mengw15 opened a new pull request, #6529:
URL: https://github.com/apache/texera/pull/6529
### What changes were proposed in this PR?
Adds a Vitest spec for `DatasetSelectionModalComponent`
(`frontend/src/app/workspace/component/dataset-selection-modal/`), which
previously had no spec (codecov ~11%).
6 tests, using `TestBed` + `detectChanges()`, with `DatasetService` and
`NzModalRef` stubbed (`vi.fn()` returning `of(...)`) and `NZ_MODAL_DATA`
provided so the modal receives its `{ fileMode, selectedPath }`:
- **create + render** — loads accessible datasets on init; the confirm button
renders disabled until a path is chosen.
- **`ngOnInit` from `data.selectedPath`** — in file mode, splits the path into
owner / dataset / version and initializes `selectedDataset`, `datasetVersions`,
`selectedVersion`, and `fileTree` accordingly.
- **`onDatasetChange`** — loads the version list and (in file mode) auto-selects
a version.
- **`onVersionChange`** — in non-file mode, composes `selectedPath` as
`/owner/dataset/version` and loads the file tree.
- **`onFileSelected`** — in file mode, sets `selectedPath` to the node's full path.
- **`onConfirmSelection`** — closes the modal with `selectedPath`.
`DatasetService` is stubbed inline (no shared stub exists for it). No production
code was changed.
### Any related issues, documentation, discussions?
Closes #6516
### How was this PR tested?
New 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/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
# Tests 6 passed (6)
eslint <spec> # clean
prettier --check # 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): add unit test coverage for DatasetSelectionModalComponent [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6529:
URL: https://github.com/apache/texera/pull/6529#issuecomment-5013275042
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/6529?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 70.99%. Comparing base ([`39db110`](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5839ad2`](https://app.codecov.io/gh/apache/texera/commit/5839ad28feb0c043e1986139db4b67511ca18856?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #6529 +/- ##
============================================
+ Coverage 70.57% 70.99% +0.41%
Complexity 3425 3425
============================================
Files 1146 1146
Lines 45062 45078 +16
Branches 4960 4972 +12
============================================
+ Hits 31802 32001 +199
+ Misses 11613 11424 -189
- Partials 1647 1653 +6
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/6529/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/6529/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 [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/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 [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.72% <ø> (ø)` | | Carriedforward from [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `17.72% <ø> (ø)` | | Carriedforward from [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.30% <ø> (ø)` | | Carriedforward from [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.80% <ø> (ø)` | | Carriedforward from [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.34% <ø> (+0.97%)` | :arrow_up: | |
| [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/6529/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 [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `91.74% <ø> (ø)` | | Carriedforward from [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529/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 [39db110](https://app.codecov.io/gh/apache/texera/commit/39db110e74b4bdcf0e4b0df961c25973e6bbb20c?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/6529?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): add unit test coverage for DatasetSelectionModalComponent [texera]
Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 commented on code in PR #6529:
URL: https://github.com/apache/texera/pull/6529#discussion_r3609366662
##########
frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts:
##########
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { ComponentFixture, TestBed } from "@angular/core/testing";
+import { of } from "rxjs";
+import { NZ_MODAL_DATA, NzModalRef } from "ng-zorro-antd/modal";
+import { DatasetSelectionModalComponent } from "./dataset-selection-modal.component";
+import { DatasetService } from "../../../dashboard/service/user/dataset/dataset.service";
+import { DashboardDataset } from "../../../dashboard/type/dashboard-dataset.interface";
+import { DatasetVersion } from "../../../common/type/dataset";
+import { DatasetFileNode } from "../../../common/type/datasetVersionFileTree";
+
+const OWNER = "owner@x.com";
+
+const dataset: DashboardDataset = {
+ isOwner: true,
+ ownerEmail: OWNER,
+ dataset: {
+ did: 10,
+ name: "myds",
+ ownerUid: 1,
+ isPublic: false,
+ isDownloadable: false,
+ storagePath: undefined,
+ description: "",
+ creationTime: undefined,
+ coverImage: undefined,
+ },
+ accessPrivilege: "WRITE",
+ size: 0,
+};
+
+const version: DatasetVersion = {
+ dvid: 100,
+ did: 10,
+ creatorUid: 1,
+ name: "v1",
+ versionHash: undefined,
+ creationTime: undefined,
+ fileNodes: undefined,
+};
+
+const fileNode: DatasetFileNode = { name: "a.csv", type: "file", parentDir: `/${OWNER}/myds/v1` };
+
+describe("DatasetSelectionModalComponent", () => {
+ let component: DatasetSelectionModalComponent;
+ let fixture: ComponentFixture<DatasetSelectionModalComponent>;
+ let modalData: { fileMode: boolean; selectedPath?: string | null };
+ let modalRef: { close: ReturnType<typeof vi.fn> };
+ let datasetService: {
+ retrieveAccessibleDatasets: ReturnType<typeof vi.fn>;
+ retrieveDatasetVersionList: ReturnType<typeof vi.fn>;
+ retrieveDatasetVersionFileTree: ReturnType<typeof vi.fn>;
+ };
+
+ // Build the component after the test has configured `modalData`, so that
+ // ngOnInit (run by detectChanges) sees the intended fileMode / selectedPath.
+ function build(): void {
+ fixture = TestBed.createComponent(DatasetSelectionModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }
+
+ beforeEach(async () => {
+ modalData = { fileMode: false };
+ modalRef = { close: vi.fn() };
+ datasetService = {
+ retrieveAccessibleDatasets: vi.fn().mockReturnValue(of([dataset])),
+ retrieveDatasetVersionList: vi.fn().mockReturnValue(of([version])),
+ retrieveDatasetVersionFileTree: vi.fn().mockReturnValue(of({ fileNodes: [fileNode], size: 0 })),
+ };
+
+ await TestBed.configureTestingModule({
+ imports: [DatasetSelectionModalComponent],
+ providers: [
+ { provide: NZ_MODAL_DATA, useValue: modalData },
+ { provide: NzModalRef, useValue: modalRef },
+ { provide: DatasetService, useValue: datasetService },
+ ],
+ }).compileComponents();
+ });
+
+ it("creates and renders, loading the accessible datasets", () => {
+ build();
+ expect(component).toBeTruthy();
+ expect(datasetService.retrieveAccessibleDatasets).toHaveBeenCalled();
+ expect(component.datasets).toEqual([dataset]);
+ // template rendered: the confirm button is disabled until a path is selected
+ const button: HTMLButtonElement = fixture.nativeElement.querySelector("button[nz-button]");
+ expect(button.disabled).toBe(true);
+ });
+
+ it("ngOnInit initializes selectedDataset and selectedVersion from data.selectedPath", () => {
+ modalData.fileMode = true;
+ modalData.selectedPath = `/${OWNER}/myds/v1`;
+
+ build();
+
+ expect(component.selectedDataset).toBe(dataset);
+ expect(component.datasetVersions).toEqual([version]);
+ expect(component.selectedVersion).toBe(version);
+ expect(component.fileTree).toEqual([fileNode]);
+ expect(datasetService.retrieveDatasetVersionList).toHaveBeenCalledWith(10);
+ expect(datasetService.retrieveDatasetVersionFileTree).toHaveBeenCalledWith(10, 100);
+ });
+
+ it("onDatasetChange loads the version list and auto-selects a version in file mode", () => {
+ modalData.fileMode = true;
+ build();
+
+ component.selectedDataset = dataset;
+ component.onDatasetChange();
+
+ expect(datasetService.retrieveDatasetVersionList).toHaveBeenCalledWith(10);
+ expect(component.datasetVersions).toEqual([version]);
+ expect(component.selectedVersion).toBe(version);
+ });
+
+ it("onVersionChange composes selectedPath from the dataset/version in non-file mode", () => {
+ build(); // fileMode false
+
+ component.selectedDataset = dataset;
+ component.selectedVersion = version;
+ component.onVersionChange();
+
+ expect(datasetService.retrieveDatasetVersionFileTree).toHaveBeenCalledWith(10, 100);
+ expect(component.fileTree).toEqual([fileNode]);
+ expect(component.selectedPath).toBe(`/${OWNER}/myds/v1`);
+ });
+
+ it("onFileSelected sets selectedPath to the node's full path in file mode", () => {
+ modalData.fileMode = true;
+ build();
+
+ component.onFileSelected(fileNode);
+
+ expect(component.selectedPath).toBe(`/${OWNER}/myds/v1/a.csv`);
+ });
+
+ it("onConfirmSelection closes the modal with the selected path", () => {
+ build();
+ component.selectedPath = "/some/path";
+
+ component.onConfirmSelection();
+
+ expect(modalRef.close).toHaveBeenCalledWith("/some/path");
+ });
Review Comment:
The modal's contract is a single path string, and its two callers depend on it: `dataset-version-selector` and `dataset-file-selector` both do `modal.afterClose.subscribe(selectedPath => this.formControl.setValue(selectedPath))`. Returning a structured `{ dataset, version, path }` would break both. This is a test-coverage PR, so the spec intentionally asserts the current contract; the `{ dataset, version, path }` phrasing in #6516 was approximate. No code change here — the issue text can be tightened separately if desired.
--
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): add unit test coverage for DatasetSelectionModalComponent [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #6529:
URL: https://github.com/apache/texera/pull/6529
--
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): add unit test coverage for DatasetSelectionModalComponent [texera]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6529:
URL: https://github.com/apache/texera/pull/6529#discussion_r3609360742
##########
frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts:
##########
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { ComponentFixture, TestBed } from "@angular/core/testing";
+import { of } from "rxjs";
+import { NZ_MODAL_DATA, NzModalRef } from "ng-zorro-antd/modal";
+import { DatasetSelectionModalComponent } from "./dataset-selection-modal.component";
+import { DatasetService } from "../../../dashboard/service/user/dataset/dataset.service";
+import { DashboardDataset } from "../../../dashboard/type/dashboard-dataset.interface";
+import { DatasetVersion } from "../../../common/type/dataset";
+import { DatasetFileNode } from "../../../common/type/datasetVersionFileTree";
+
+const OWNER = "owner@x.com";
+
+const dataset: DashboardDataset = {
+ isOwner: true,
+ ownerEmail: OWNER,
+ dataset: {
+ did: 10,
+ name: "myds",
+ ownerUid: 1,
+ isPublic: false,
+ isDownloadable: false,
+ storagePath: undefined,
+ description: "",
+ creationTime: undefined,
+ coverImage: undefined,
+ },
+ accessPrivilege: "WRITE",
+ size: 0,
+};
+
+const version: DatasetVersion = {
+ dvid: 100,
+ did: 10,
+ creatorUid: 1,
+ name: "v1",
+ versionHash: undefined,
+ creationTime: undefined,
+ fileNodes: undefined,
+};
+
+const fileNode: DatasetFileNode = { name: "a.csv", type: "file", parentDir: `/${OWNER}/myds/v1` };
+
+describe("DatasetSelectionModalComponent", () => {
+ let component: DatasetSelectionModalComponent;
+ let fixture: ComponentFixture<DatasetSelectionModalComponent>;
+ let modalData: { fileMode: boolean; selectedPath?: string | null };
+ let modalRef: { close: ReturnType<typeof vi.fn> };
+ let datasetService: {
+ retrieveAccessibleDatasets: ReturnType<typeof vi.fn>;
+ retrieveDatasetVersionList: ReturnType<typeof vi.fn>;
+ retrieveDatasetVersionFileTree: ReturnType<typeof vi.fn>;
+ };
+
+ // Build the component after the test has configured `modalData`, so that
+ // ngOnInit (run by detectChanges) sees the intended fileMode / selectedPath.
+ function build(): void {
+ fixture = TestBed.createComponent(DatasetSelectionModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }
+
+ beforeEach(async () => {
+ modalData = { fileMode: false };
+ modalRef = { close: vi.fn() };
+ datasetService = {
+ retrieveAccessibleDatasets: vi.fn().mockReturnValue(of([dataset])),
+ retrieveDatasetVersionList: vi.fn().mockReturnValue(of([version])),
+ retrieveDatasetVersionFileTree: vi.fn().mockReturnValue(of({ fileNodes: [fileNode], size: 0 })),
+ };
+
+ await TestBed.configureTestingModule({
+ imports: [DatasetSelectionModalComponent],
+ providers: [
+ { provide: NZ_MODAL_DATA, useValue: modalData },
+ { provide: NzModalRef, useValue: modalRef },
+ { provide: DatasetService, useValue: datasetService },
+ ],
+ }).compileComponents();
+ });
+
+ it("creates and renders, loading the accessible datasets", () => {
+ build();
+ expect(component).toBeTruthy();
+ expect(datasetService.retrieveAccessibleDatasets).toHaveBeenCalled();
+ expect(component.datasets).toEqual([dataset]);
+ // template rendered: the confirm button is disabled until a path is selected
+ const button: HTMLButtonElement = fixture.nativeElement.querySelector("button[nz-button]");
+ expect(button.disabled).toBe(true);
+ });
+
+ it("ngOnInit initializes selectedDataset and selectedVersion from data.selectedPath", () => {
+ modalData.fileMode = true;
+ modalData.selectedPath = `/${OWNER}/myds/v1`;
+
+ build();
+
+ expect(component.selectedDataset).toBe(dataset);
+ expect(component.datasetVersions).toEqual([version]);
+ expect(component.selectedVersion).toBe(version);
+ expect(component.fileTree).toEqual([fileNode]);
+ expect(datasetService.retrieveDatasetVersionList).toHaveBeenCalledWith(10);
+ expect(datasetService.retrieveDatasetVersionFileTree).toHaveBeenCalledWith(10, 100);
+ });
+
+ it("onDatasetChange loads the version list and auto-selects a version in file mode", () => {
+ modalData.fileMode = true;
+ build();
+
+ component.selectedDataset = dataset;
+ component.onDatasetChange();
+
+ expect(datasetService.retrieveDatasetVersionList).toHaveBeenCalledWith(10);
+ expect(component.datasetVersions).toEqual([version]);
+ expect(component.selectedVersion).toBe(version);
+ });
+
+ it("onVersionChange composes selectedPath from the dataset/version in non-file mode", () => {
+ build(); // fileMode false
+
+ component.selectedDataset = dataset;
+ component.selectedVersion = version;
+ component.onVersionChange();
+
+ expect(datasetService.retrieveDatasetVersionFileTree).toHaveBeenCalledWith(10, 100);
+ expect(component.fileTree).toEqual([fileNode]);
+ expect(component.selectedPath).toBe(`/${OWNER}/myds/v1`);
+ });
+
+ it("onFileSelected sets selectedPath to the node's full path in file mode", () => {
+ modalData.fileMode = true;
+ build();
+
+ component.onFileSelected(fileNode);
+
+ expect(component.selectedPath).toBe(`/${OWNER}/myds/v1/a.csv`);
+ });
+
+ it("onConfirmSelection closes the modal with the selected path", () => {
+ build();
+ component.selectedPath = "/some/path";
+
+ component.onConfirmSelection();
+
+ expect(modalRef.close).toHaveBeenCalledWith("/some/path");
+ });
Review Comment:
The linked issue (#6516) says the modal confirm should "return the selected { dataset, version, path }", but both the component implementation and this test assert that only a single string path is passed to `modalRef.close(...)`. If the issue requirement is still accurate, this PR (and the current modal contract) doesn't satisfy it; either update the issue/PR wording or change the modal + callers to close with a structured payload.
--
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): add unit test coverage for DatasetSelectionModalComponent [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6529:
URL: https://github.com/apache/texera/pull/6529#issuecomment-5013259006
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- No candidates found from `git blame` history.
--
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