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:
Jin Yi
2025-09-02 23:29:08 +09:00
parent 8e07126616
commit 86d7cbf024
2 changed files with 7 additions and 4 deletions

View File

@@ -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', () => {

View File

@@ -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', () => {