You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Ma77Ball (via GitHub)" <gi...@apache.org> on 2026/06/07 12:34:05 UTC
[I] Add unit tests for DatasetVersionSelectorComponent [texera]
Ma77Ball opened a new issue, #5470:
URL: https://github.com/apache/texera/issues/5470
### Task Summary
`DatasetVersionSelectorComponent`
(`frontend/src/app/workspace/component/dataset-version-selector/dataset-version-selector.component.ts`)
has no `*.spec.ts` file. It is a Formly `FieldType` whose only method,
`onClickOpenDatasetSelectionModal()`, opens an ng-zorro modal and, when the modal closes
with a value, writes that value into `formControl`. Its single dependency is
`NzModalService`, which is easy to stub.
### What to do (step by step)
1. Create the spec next to the component, with the Apache license header.
2. Stub `NzModalService.create` to return an object with an
`afterClose` observable you control (use `rxjs` `of(...)`).
3. Because the component extends `FieldType`, set `component.field` and
`component.formControl` (a `FormControl`) before calling the method.
4. Call `onClickOpenDatasetSelectionModal()` and assert behavior.
5. Run `yarn test -- dataset-version-selector`, then `yarn lint`.
### Cover
- `should create`.
- `onClickOpenDatasetSelectionModal()` calls `modalService.create` once.
- When `afterClose` emits a truthy path, `formControl.setValue` is called with that path.
- When `afterClose` emits a falsy value, `formControl` is left unchanged.
### Suggested providers / mocks
```ts
import { of } from "rxjs";
import { FormControl } from "@angular/forms";
import { NzModalService } from "ng-zorro-antd/modal";
const modalServiceSpy = {
create: vi.fn().mockReturnValue({ afterClose: of("/selected/path") }),
};
providers: [{ provide: NzModalService, useValue: modalServiceSpy }]
// in the test, before calling the method:
component.field = {} as any;
(component as any).formControl = new FormControl("");
```
> Sibling component `DatasetFileSelectorComponent` is nearly identical; the same test
> shape applies (see its own draft).
### 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: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add unit tests for DatasetVersionSelectorComponent [texera]
Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang closed issue #5470: Add unit tests for DatasetVersionSelectorComponent
URL: https://github.com/apache/texera/issues/5470
--
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: [I] Add unit tests for DatasetVersionSelectorComponent [texera]
Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on issue #5470:
URL: https://github.com/apache/texera/issues/5470#issuecomment-4642702124
reserved for first-time contributor
--
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: [I] Add unit tests for DatasetVersionSelectorComponent [texera]
Posted by "yangzhang75 (via GitHub)" <gi...@apache.org>.
yangzhang75 commented on issue #5470:
URL: https://github.com/apache/texera/issues/5470#issuecomment-4654718353
/take
--
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