fix(admin,frontend): fix hydration mismatch, admin UI texts sync, and product image resolution
Deploy Canina / deploy (push) Failing after 1s

This commit is contained in:
parsa aghaei committed 2026-08-15 15:16:04 +03:30
1 parent 3122c5b13f
commit 5ec99155c4
7 files changed
+103 -31

No files matched your search

@@ -14,25 +14,25 @@ describe('Hero', () => {
vi.clearAllMocks();
});
it('renders title and description from settingsStore', () => {
it('renders title and description from settingsStore', async () => {
const mockGetText = vi.fn().mockImplementation((key, fallback) => {
if (key === 'hero_title') return 'Test Title Line 1\nTest Title Line 2';
if (key === 'hero_desc') return 'Test Description Text';
return fallback;
});
vi.mocked(useSettingsStore).mockImplementation((selector: (state: { getText: (key: string, fallback: string) => string }) => unknown) => selector({ getText: mockGetText }) as ReturnType<typeof selector>);
vi.mocked(useSettingsStore).mockImplementation((selector: (state: { getText: (key: string, fallback: string) => string; isInitialized: boolean }) => unknown) => selector({ getText: mockGetText, isInitialized: true }) as ReturnType<typeof selector>);
render(<Hero onShopNavigate={vi.fn()} />);
expect(screen.getByText('Test Title Line 1')).toBeInTheDocument();
expect(screen.getByText('Test Title Line 2')).toBeInTheDocument();
expect(screen.getByText('Test Description Text')).toBeInTheDocument();
expect(await screen.findByText('Test Title Line 1')).toBeInTheDocument();
expect(await screen.findByText('Test Title Line 2')).toBeInTheDocument();
expect(await screen.findByText('Test Description Text')).toBeInTheDocument();
});
it('calls onShopNavigate when "مشاهده محصولات" button is clicked', () => {
const mockGetText = vi.fn().mockImplementation((_key, fallback) => fallback);
vi.mocked(useSettingsStore).mockImplementation((selector: (state: { getText: (key: string, fallback: string) => string }) => unknown) => selector({ getText: mockGetText }) as ReturnType<typeof selector>);
vi.mocked(useSettingsStore).mockImplementation((selector: (state: { getText: (key: string, fallback: string) => string; isInitialized: boolean }) => unknown) => selector({ getText: mockGetText, isInitialized: true }) as ReturnType<typeof selector>);
const handleShopNavigate = vi.fn();
render(<Hero onShopNavigate={handleShopNavigate} />);