Comfy-Org / Comfy-Org/ComfyUI_frontend

test: drive uninitialized→ready state transition in WorkspaceAuthGate resumePendingPricingFlow test

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

Description

## Follow-up: Improve WorkspaceAuthGate test coverage for `resumePendingPricingFlow`

### Background

In PR #9901, a test was added to verify that `resumePendingPricingFlow` is called after successful workspace initialization in `WorkspaceAuthGate`:

> **File:** `src/platform/workspace/auth/WorkspaceAuthGate.test.ts`

The current test sets `mockWorkspaceStoreInitState` to `'ready'` before mounting, which skips the `initialize()` path entirely (the store starts already-ready). This means the test passes even if `resumePendingPricingFlow` runs too early or only when the store already starts in a ready state, rather than after a successful init transition.

### Suggested improvement

Drive the state transition through `mockWorkspaceStoreInitialize()` so the test exercises the full `uninitialized → ready` path:

```diff
it('calls resumePendingPricingFlow after successful workspace init', async () => {
mockTeamWorkspacesEnabled.value = true
- mockWorkspaceStoreInitState.value = 'ready'
+ mockWorkspaceStoreInitState.value = 'uninitialized'
+ mockWorkspaceStoreInitialize.mockImplementation(async () => {
+ mockWorkspaceStoreInitState.value = 'ready'
+ })

mountComponent()
await flushPromises()

+ expect(mockWorkspaceStoreInitialize).toHaveBeenCalled()
expect(mockResumePendingPricingFlow).toHaveBeenCalled()
})
```

This ensures the test validates `WorkspaceAuthGate`'s internal wiring — that `resumePendingPricingFlow` is triggered specifically as a result of a completed initialization, not simply because the store happened to start ready.

### References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9901
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9901#discussion_r2944311952
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10212-test-drive-uninitialized-ready-state-transition-in-WorkspaceAuthGate-resumePendingPr-3266d73d365081cbb5f7d752968c7f65) 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.