refactor: namaing function modified

This commit is contained in:
Jin Yi
2025-09-07 19:14:00 +09:00
parent 007560d391
commit 7f7189d1d0
5 changed files with 88 additions and 94 deletions

View File

@@ -25,7 +25,7 @@ vi.mock('@/services/comfyManagerService')
vi.mock('@/composables/useConflictDetection', () => ({
useConflictDetection: vi.fn(() => ({
conflictedPackages: { value: [] },
performConflictDetection: vi.fn().mockResolvedValue(undefined)
runFullConflictAnalysis: vi.fn().mockResolvedValue(undefined)
}))
}))

View File

@@ -173,8 +173,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
describe('system environment detection', () => {
it('should collect system environment information successfully', async () => {
const { detectSystemEnvironment } = useConflictDetection()
const environment = await detectSystemEnvironment()
const { collectSystemEnvironment } = useConflictDetection()
const environment = await collectSystemEnvironment()
expect(environment.comfyui_version).toBe('0.3.41')
expect(environment.frontend_version).toBe('1.24.0-1')
@@ -190,8 +190,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
)
mockSystemStatsStore.systemStats = null
const { detectSystemEnvironment } = useConflictDetection()
const environment = await detectSystemEnvironment()
const { collectSystemEnvironment } = useConflictDetection()
const environment = await collectSystemEnvironment()
expect(environment.comfyui_version).toBe('unknown')
expect(environment.frontend_version).toBe('1.24.0-1')
@@ -260,8 +260,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.total_packages).toBeGreaterThanOrEqual(1)
@@ -309,8 +309,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
// Mock Registry Service returning null (no packages found)
mockRegistryService.getPackByVersion.mockResolvedValue(null)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.total_packages).toBe(1)
@@ -332,8 +332,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
it('should return empty array when local package information cannot be retrieved', async () => {
mockComfyManagerService.listInstalledPacks.mockResolvedValue(null)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.total_packages).toBe(0)
@@ -377,8 +377,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.conflicted_packages).toBe(0)
@@ -420,8 +420,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.conflicted_packages).toBe(1)
@@ -472,8 +472,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.conflicted_packages).toBe(1)
@@ -523,8 +523,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.banned_packages).toBe(1)
@@ -577,8 +577,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.banned_packages).toBe(1)
@@ -633,13 +633,13 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { hasConflicts, performConflictDetection } = useConflictDetection()
const { hasConflicts, runFullConflictAnalysis } = useConflictDetection()
// Initial value should be false
expect(hasConflicts.value).toBe(false)
// Execute conflict detection
await performConflictDetection()
await runFullConflictAnalysis()
await nextTick()
// Should be true when conflicts are detected
@@ -680,10 +680,10 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { conflictedPackages, performConflictDetection } =
const { conflictedPackages, runFullConflictAnalysis } =
useConflictDetection()
await performConflictDetection()
await runFullConflictAnalysis()
await nextTick()
expect(conflictedPackages.value.length).toBeGreaterThan(0)
@@ -740,10 +740,10 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { bannedPackages, performConflictDetection } =
const { bannedPackages, runFullConflictAnalysis } =
useConflictDetection()
await performConflictDetection()
await runFullConflictAnalysis()
await nextTick()
expect(bannedPackages.value).toHaveLength(1)
@@ -766,8 +766,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.detected_system_environment?.comfyui_version).toBe(
@@ -781,8 +781,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
new Error('Service error')
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.total_packages).toBe(0)
@@ -830,8 +830,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true)
expect(result.summary.total_packages).toBeGreaterThanOrEqual(1)
@@ -862,8 +862,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
new Error('Critical error')
)
const { performConflictDetection } = useConflictDetection()
const result = await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
const result = await runFullConflictAnalysis()
expect(result.success).toBe(true) // Error resilience maintains success
expect(result.summary.total_packages).toBe(0)
@@ -889,8 +889,8 @@ describe.skip('useConflictDetection with Registry Store', () => {
status: 'NodeVersionStatusActive'
})
const { performConflictDetection } = useConflictDetection()
await performConflictDetection()
const { runFullConflictAnalysis } = useConflictDetection()
await runFullConflictAnalysis()
expect(mockAcknowledgment.checkComfyUIVersionChange).toHaveBeenCalledWith(
'0.3.41'
@@ -945,11 +945,11 @@ describe.skip('useConflictDetection with Registry Store', () => {
}
)
const { shouldShowConflictModalAfterUpdate, performConflictDetection } =
const { shouldShowConflictModalAfterUpdate, runFullConflictAnalysis } =
useConflictDetection()
// First run conflict detection to populate conflicts
await performConflictDetection()
await runFullConflictAnalysis()
await nextTick()
// Now check if modal should show after update
@@ -967,10 +967,10 @@ describe.skip('useConflictDetection with Registry Store', () => {
devices: []
}
const { detectSystemEnvironment } = useConflictDetection()
const { collectSystemEnvironment } = useConflictDetection()
// Detect system environment
const environment = await detectSystemEnvironment()
const environment = await collectSystemEnvironment()
expect(environment.comfyui_version).toBe('0.3.41')
})