mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
[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:
@@ -10,7 +10,13 @@ import type { MergedNodePack, RegistryPack } from '@/types/comfyManagerTypes'
|
|||||||
// Mock dependencies
|
// Mock dependencies
|
||||||
vi.mock('vue-i18n', () => ({
|
vi.mock('vue-i18n', () => ({
|
||||||
useI18n: vi.fn(() => ({
|
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)
|
t: vi.fn((key: string) => key)
|
||||||
})),
|
})),
|
||||||
createI18n: vi.fn(() => ({
|
createI18n: vi.fn(() => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user