Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update tests
  • Loading branch information
christian-byrne committed Nov 30, 2025
commit 057105afd08ad0da42af3a916c8657a002b3e5d8
35 changes: 35 additions & 0 deletions tests-ui/tests/store/versionCompatibilityStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { ref } from 'vue'

import { useVersionCompatibilityStore } from '@/platform/updates/common/versionCompatibilityStore'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useSystemStatsStore } from '@/stores/systemStatsStore'

vi.mock('@/config', () => ({
Expand All @@ -13,6 +14,13 @@ vi.mock('@/config', () => ({

vi.mock('@/stores/systemStatsStore')

// Mock settingStore
vi.mock('@/platform/settings/settingStore', () => ({
useSettingStore: vi.fn(() => ({
get: vi.fn(() => false) // Default to warnings enabled (false = not disabled)
}))
}))

// Mock useStorage and until from VueUse
const mockDismissalStorage = ref({} as Record<string, number>)
vi.mock('@vueuse/core', () => ({
Expand All @@ -23,6 +31,7 @@ vi.mock('@vueuse/core', () => ({
describe('useVersionCompatibilityStore', () => {
let store: ReturnType<typeof useVersionCompatibilityStore>
let mockSystemStatsStore: any
let mockSettingStore: any

beforeEach(() => {
setActivePinia(createPinia())
Expand All @@ -36,7 +45,12 @@ describe('useVersionCompatibilityStore', () => {
refetchSystemStats: vi.fn()
}

mockSettingStore = {
get: vi.fn(() => false) // Default to warnings enabled
}

vi.mocked(useSystemStatsStore).mockReturnValue(mockSystemStatsStore)
vi.mocked(useSettingStore).mockReturnValue(mockSettingStore)

store = useVersionCompatibilityStore()
})
Expand Down Expand Up @@ -196,6 +210,27 @@ describe('useVersionCompatibilityStore', () => {

expect(store.shouldShowWarning).toBe(false)
})

it('should not show warning when disabled via setting', async () => {
// Enable the disable setting
mockSettingStore.get.mockReturnValue(true)

// Set up version mismatch that would normally show warning
mockSystemStatsStore.systemStats = {
system: {
comfyui_version: '1.25.0',
required_frontend_version: '1.25.0'
}
}
mockSystemStatsStore.isInitialized = true

await store.checkVersionCompatibility()

expect(store.shouldShowWarning).toBe(false)
expect(mockSettingStore.get).toHaveBeenCalledWith(
'Comfy.VersionCompatibility.DisableWarnings'
)
})
})

describe('warning messages', () => {
Expand Down
Loading