Add unit tests for VisualizationFrameContentComponent
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Task Summary
`VisualizationFrameContentComponent` (`frontend/src/app/workspace/component/visualization-panel-content/visualization-frame-content.component.ts`) has no `*.spec.ts` file. It is ~87 lines, takes an `@Input() operatorId`, and depends on `WorkflowResultService` and `DomSanitizer`. Its work happens in `ngAfterContentInit()` and `drawChart()`.
### What to do (step by step)
1. Create the spec next to the component, with the Apache license header.
2. Stub `WorkflowResultService` to return the result/observable that `drawChart` consumes (read the method to see which getter it calls), and stub `DomSanitizer` with a `bypassSecurityTrust*` `vi.fn()`.
3. Set `component.operatorId` before triggering the lifecycle.
4. Assert creation and that `drawChart` pulls data via the service and sets the field the template renders.
5. Run `yarn test -- visualization-frame-content`, then `yarn lint`.
### Cover
- `should create`.
- `drawChart()` reads the operator result for `operatorId` from `WorkflowResultService` and produces the sanitized HTML / chart field the template binds to.
- A no-data / undefined-result branch (if present) is handled without throwing.
### Suggested providers / mocks
```ts
import { WorkflowResultService } from "src/app/workspace/service/workflow-result/workflow-result.service";
import { DomSanitizer } from "@angular/platform-browser";
const resultServiceSpy = { /* the getter drawChart calls, returning sample result data */ };
providers: [
{ provide: WorkflowResultService, useValue: resultServiceSpy },
{ provide: DomSanitizer, useValue: { bypassSecurityTrustHtml: vi.fn(x => x) } },
]
```
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
Contributor guide
Assessment
This issue has not been assessed yet.