mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
test: Fix test failures after reactive feature flags implementation
- Update useFeatureFlags test to handle computed ref correctly - Update managerStateStore test to reflect new LEGACY_UI behavior - Remove unused isReactive import
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { isReactive, isReadonly } from 'vue'
|
||||
import { isReadonly } from 'vue'
|
||||
|
||||
import {
|
||||
ServerFeatureFlag,
|
||||
@@ -38,7 +38,9 @@ describe('useFeatureFlags', () => {
|
||||
const { flags } = useFeatureFlags()
|
||||
|
||||
expect(isReadonly(flags)).toBe(true)
|
||||
expect(isReactive(flags)).toBe(true)
|
||||
// computed returns a ComputedRef which is readonly but not reactive
|
||||
// The value inside is reactive though
|
||||
expect(flags.value).toBeDefined()
|
||||
})
|
||||
|
||||
it('should access supportsPreviewMetadata', () => {
|
||||
|
||||
@@ -141,7 +141,7 @@ describe('useManagerStateStore', () => {
|
||||
expect(store.managerUIState).toBe(ManagerUIState.DISABLED)
|
||||
})
|
||||
|
||||
it('should return DISABLED state when no manager is available', () => {
|
||||
it('should return LEGACY_UI state when server explicitly does not support v4', () => {
|
||||
vi.mocked(useSystemStatsStore).mockReturnValue({
|
||||
systemStats: { system: { argv: ['python', 'main.py'] } }
|
||||
} as any)
|
||||
@@ -156,7 +156,8 @@ describe('useManagerStateStore', () => {
|
||||
|
||||
const store = useManagerStateStore()
|
||||
|
||||
expect(store.managerUIState).toBe(ManagerUIState.DISABLED)
|
||||
// When server explicitly returns false for v4 support, we assume legacy manager exists
|
||||
expect(store.managerUIState).toBe(ManagerUIState.LEGACY_UI)
|
||||
})
|
||||
|
||||
it('should handle null systemStats gracefully', () => {
|
||||
|
||||
Reference in New Issue
Block a user