Comfy-Org / Comfy-Org/ComfyUI_frontend

test: add unit tests for resolveBlueprintIcon, resolveBlueprintSuffix, and resolveBlueprintEssentialsCategory

Open
#10,155 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
area:testing
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Three new exported pure functions were added to `src/constants/essentialsDisplayNames.ts` in PR #10113, but no unit tests were added for them:

- `resolveBlueprintIcon(nodeName)` — derives an icon class from the blueprint prefix
- `resolveBlueprintSuffix(nodeName)` — extracts and title-cases the provider/model suffix from a blueprint name
- `resolveBlueprintEssentialsCategory(nodeName)` — returns the `EssentialsCategory` for a blueprint node, or `undefined`

The existing test file (`essentialsDisplayNames.test.ts`) only covers `resolveEssentialsDisplayName`.

## Suggested test coverage

- **`resolveBlueprintIcon`**: prefix matching → correct icon class string; non-blueprint name → `undefined`; trailing underscore stripped correctly
- **`resolveBlueprintSuffix`**: suffix title-casing (e.g. `text_to_image_flux_1` → `"Flux 1"`); no suffix → `undefined`; non-blueprint name → `undefined`
- **`resolveBlueprintEssentialsCategory`**: correct category returned for each prefix group; non-blueprint name → `undefined`; unrecognized blueprint prefix → `undefined`

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10113
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10113#discussion_r2945046825
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10155-test-add-unit-tests-for-resolveBlueprintIcon-resolveBlueprintSuffix-and-resolveBlu-3266d73d365081479b13c202d1410919) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.