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

   ### What changes were proposed in this PR?
   
   Adds a Vitest spec for `UserDatasetVersionCreatorComponent`
   
(`frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-version-creator/user-dataset-version-creator.component.ts`),
   previously without a spec (~3% coverage). `NZ_MODAL_DATA`, `NzModalRef`,
   `DatasetService`, and `NotificationService` are stubbed; a minimal formly
   "input" type is registered so the declared fields materialize into real form
   controls (with validators) on render.
   
   10 tests cover:
   
   - `should create` and render the formly form.
   - `ngOnInit` builds the version-description field when `isCreatingVersion`, 
and the name + description fields otherwise.
   - Form validity gating — `onClickCreate` is a no-op (no service call, modal 
stays open) while the required `name` is empty.
   - `onClickCreate` (dataset mode) — creates the dataset with a sanitized name 
and the public/downloadable flags, then closes the modal with the result on 
success.
   - `onClickCreate` (version mode) — calls `createDatasetVersion(did, 
description)` and closes on success; notifies and closes with `null` on failure.
   - `onClickCancel` closes the modal with `null`.
   - `datasetNameSanitization` lowercases, dashes non-alphanumerics, and flags 
the change.
   - The public / downloadable switch handlers update their flags.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6508
   
   ### How was this PR tested?
   
   New unit tests, run locally in `frontend/` (all green; the failure path was
   verified by deliberately breaking the form-validity assertion to confirm the
   suite goes red):
   
   ```
   ng test --watch=false --include 
src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-version-creator/user-dataset-version-creator.component.spec.ts
   # Test Files 1 passed (1) | Tests 10 passed (10)
   prettier --write <spec>   # formatted
   eslint  <spec>            # clean
   ```
   
   The dataset service and modal ref are stubbed, so the suite makes no network
   calls and opens no real modal (see `frontend/TESTING.md`).
   
   ### 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]

Reply via email to