Ma77Ball opened a new issue, #5471:
URL: https://github.com/apache/texera/issues/5471

   ### Task Summary
   
   
   `DatasetFileSelectorComponent`
   
(`frontend/src/app/workspace/component/dataset-file-selector/dataset-file-selector.component.ts`)
   has no `*.spec.ts` file. It is a Formly `FieldType` whose only method,
   `onClickOpenFileSelectionModal()`, opens an ng-zorro modal and writes the 
chosen path back
   into `formControl` when the modal closes with a value. It injects 
`NzModalService`,
   `WorkflowActionService`, and `GuiConfigService`.
   
   ### What to do (step by step)
   
   1. Create the spec next to the component, with the Apache license header.
   2. Stub the three injected services. Only `NzModalService.create` needs real 
behavior
      (return `{ afterClose: of("/path") }`); the others can be empty `vi.fn()` 
stubs unless
      the method reads from them, in which case provide the minimal fields it 
uses.
   3. Because the component extends `FieldType`, set `component.field` and
      `component.formControl` (a `FormControl`) before calling the method.
   4. Assert behavior, run `yarn test -- dataset-file-selector`, then `yarn 
lint`.
   
   ### Cover
   
   - `should create`.
   - `onClickOpenFileSelectionModal()` calls `modalService.create` once.
   - When `afterClose` emits a truthy path, `formControl.setValue` is called 
with it.
   - When `afterClose` emits a falsy value, `formControl` is unchanged.
   
   ### Suggested providers / mocks
   
   ```ts
   import { of } from "rxjs";
   import { FormControl } from "@angular/forms";
   import { NzModalService } from "ng-zorro-antd/modal";
   import { WorkflowActionService } from 
"src/app/workspace/service/workflow-graph/model/workflow-action.service";
   import { GuiConfigService } from "src/app/common/service/gui-config.service";
   
   const modalServiceSpy = { create: vi.fn().mockReturnValue({ afterClose: 
of("/path") }) };
   providers: [
     { provide: NzModalService, useValue: modalServiceSpy },
     { provide: WorkflowActionService, useValue: {} },
     { provide: GuiConfigService, useValue: {} },
   ]
   ```
   
   > This mirrors `DatasetVersionSelectorComponent`. Read the method body to 
confirm which
   > service fields it actually reads and keep the stubs minimal.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other


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