mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-21 21:09:00 +00:00
test: add cloud-mode auth fallback regression test
Make isCloud dynamic in test mock so cloud mode can be toggled per test. Add test asserting CurrentUserButton is shown for logged-out cloud users when workflow tabs are in the sidebar (covers showCurrentUser = isCloud || isLoggedIn).
This commit is contained in:
@@ -24,6 +24,7 @@ import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore'
|
||||
const mockData = vi.hoisted(() => ({
|
||||
isLoggedIn: false,
|
||||
isDesktop: false,
|
||||
isCloud: false,
|
||||
setShowConflictRedDot: (_value: boolean) => {}
|
||||
}))
|
||||
|
||||
@@ -36,7 +37,9 @@ vi.mock('@/composables/auth/useCurrentUser', () => ({
|
||||
}))
|
||||
|
||||
vi.mock('@/platform/distribution/types', () => ({
|
||||
isCloud: false,
|
||||
get isCloud() {
|
||||
return mockData.isCloud
|
||||
},
|
||||
isNightly: false,
|
||||
get isDesktop() {
|
||||
return mockData.isDesktop
|
||||
@@ -193,6 +196,7 @@ describe('TopMenuSection', () => {
|
||||
localStorage.clear()
|
||||
mockData.isDesktop = false
|
||||
mockData.isLoggedIn = false
|
||||
mockData.isCloud = false
|
||||
mockData.setShowConflictRedDot(false)
|
||||
})
|
||||
|
||||
@@ -220,6 +224,14 @@ describe('TopMenuSection', () => {
|
||||
expect(container.querySelector('login-button-stub')).not.toBeNull()
|
||||
expect(container.querySelector('current-user-button-stub')).toBeNull()
|
||||
})
|
||||
|
||||
it('should display CurrentUserButton when user is logged out on cloud', () => {
|
||||
mockData.isLoggedIn = false
|
||||
mockData.isCloud = true
|
||||
const { container } = createSidebarTabsWrapper()
|
||||
expect(container.querySelector('current-user-button-stub')).not.toBeNull()
|
||||
expect(container.querySelector('login-button-stub')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
it('shows the active jobs label with the current count', async () => {
|
||||
|
||||
Reference in New Issue
Block a user