Comfy-Org / Comfy-Org/ComfyUI_frontend
test(assetsStore): improve test comprehensiveness and avoid inline type redefinition
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
The `src/stores/assetsStore.test.ts` file has two areas for improvement:
1. **Avoid redefining types inline within the test module.** The test mock for `TaskItemImpl` and supporting constructs (e.g., `PREVIEWABLE_MEDIA_TYPES`, output shape types) are redefined locally rather than imported from the production modules. This creates a risk of type drift and duplicates logic that should have a single source of truth. Types and filtering logic should be imported directly from their canonical locations (e.g., `src/stores/queueStore`, `src/platform/remote/comfyui/jobs/jobTypes`).
2. **Improve test comprehensiveness.** Current test coverage for history asset loading, media type filtering (e.g., missing `'3D'` in the previewable set), edge cases, and output mapping could be expanded to better exercise the store's behavior and prevent regressions.
## References
- Related PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9724
- Originating review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9724#discussion_r2914980664
- Requested by: @DrJKL
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9728-test-assetsStore-improve-test-comprehensiveness-and-avoid-inline-type-redefinition-3206d73d365081ec9e35c9c9f42187bc) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.