mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-08 06:30:04 +00:00
## Summary Extract a shared `createMockWidget` test factory to eliminate duplicated `SimplifiedWidget` object construction across 13 widget component test files. ## Changes - **What**: Add `widgetTestUtils.ts` with a generic `createMockWidget<T>` factory providing sensible defaults (`name`, `type`, `options`). Refactor 13 test files to delegate to it via thin local wrappers that supply component-specific defaults (combo values, slider ranges, etc.). ## Review Focus - The shared factory only covers `SimplifiedWidget`-based tests. Three files using different base types (`NodeWidgets.test.ts`, `useRemoteWidget.test.ts`, `useComboWidget.test.ts`) are intentionally excluded. - `mountComponent` helpers remain per-file since plugin/component setups vary too much to share. Fixes #5554 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9423-refactor-extract-shared-createMockWidget-factory-for-widget-component-tests-31a6d73d36508159b65ee0e7b49212c3) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: GitHub Action <action@github.com>