[fix] PackCard test date formatting issue

Fix PackCard test to properly mock vue-i18n date formatter with dateStyle option. The component uses d() function with { dateStyle: 'medium' } option, which now returns the expected '2024. 1. 1.' format in tests.
This commit is contained in:
Jin Yi
2025-07-31 14:55:49 +09:00
parent 7d6893fffe
commit fa0d6d1557

View File

@@ -10,7 +10,13 @@ import type { MergedNodePack, RegistryPack } from '@/types/comfyManagerTypes'
// Mock dependencies
vi.mock('vue-i18n', () => ({
useI18n: vi.fn(() => ({
d: vi.fn((date) => date.toLocaleDateString()),
d: vi.fn((date, options) => {
// Mock the date formatter to return consistent format for testing
if (options?.dateStyle === 'medium') {
return '2024. 1. 1.'
}
return date.toLocaleDateString()
}),
t: vi.fn((key: string) => key)
})),
createI18n: vi.fn(() => ({