Comfy-Org / Comfy-Org/ComfyUI_frontend

Strengthen usage and subscription tests with observable behavior assertions

Open
#17,254 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

Some usage/subscription tests assert that formatting helpers or mocked services were called without checking the result users receive. These can pass when visible output is wrong and fail on harmless refactors.

Concrete examples in [UsageLogsTable.test.ts](https://github.com/Comfy-Org/ComfyUI_frontend/blob/686a91971eccaec062b39830764b04e5d0aa8a03/src/components/dialog/content/setting/UsageLogsTable.test.ts): `renders event type badges` only checks formatter/severity helper calls, and `renders formatted dates` only checks the date formatter call. Audit [useSubscription.test.ts](https://github.com/Comfy-Org/ComfyUI_frontend/blob/686a91971eccaec062b39830764b04e5d0aa8a03/src/platform/cloud/subscription/composables/useSubscription.test.ts) as well, but preserve meaningful returned-state and billing-rail assertions already present. Call-count assertions can be valid for duplicate-request behavior and should not be removed indiscriminately.

Acceptance:

- Assert rendered badge/date/amount output and returned subscription state for asymmetric inputs.
- Remove pure default-equality or mock-echo cases that provide no behavioral coverage.
- Deliberately wrong rendering/state implementations fail the improved tests.
- A behavior-preserving refactor does not break those tests.

Follow the test-quality guidance in AGENTS.md and docs/guidance/vitest.md. Upstream transfer for FE-2117; implementation belongs upstream.

Contributor guide

Open the contributing guide

Research direction

Read AGENTS.md and docs/guidance/vitest.md first, then inspect UsageLogsTable.test.ts and useSubscription.test.ts. Run the focused tests before changing them. Done means asymmetric badge, date, amount, and subscription-state behavior is asserted, meaningless mock-echo checks are removed, and deliberately wrong behavior fails without breaking behavior-preserving refactors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.