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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]