canina/frontend/application/components/__tests__/Footer.test.tsx
parsa aghaei 7615aa0e51 fix: resolve seed encoding, search param, and wiki data source issues
- Fix seed-products.ts TS error (implicit any) and BOM handling
- Re-run full seed to restore correct Persian encoding in DB
- Fix productService query→search param mismatch
- Fix IngredientWiki hardcoded port 4000→use settingsStore
- Restore seed-products-data.json from git after accidental corruption
2026-07-11 15:40:49 +03:30

45 lines
1.6 KiB
TypeScript

"use client";
import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import React from 'react';
import Footer from '../Footer';
describe('Footer', () => {
it('renders footer brand text and standard layout elements', () => {
render(<Footer onNavigate={vi.fn()} onShopNavigate={vi.fn()} onB2BOpen={vi.fn()} />);
expect(screen.getByText('کانینا ایران')).toBeInTheDocument();
expect(screen.getByText('نماینده رسمی در ایران')).toBeInTheDocument();
expect(screen.getByText('تهران، جردن، خیابان سعیدی، ساختمان کانینا، طبقه ۵، واحد ۱۹')).toBeInTheDocument();
});
it('triggers onNavigate and onShopNavigate when quick links are clicked', () => {
const handleNavigate = vi.fn();
const handleShopNavigate = vi.fn();
const handleB2BOpen = vi.fn();
render(
<Footer
onNavigate={handleNavigate}
onShopNavigate={handleShopNavigate}
onB2BOpen={handleB2BOpen}
/>
);
// Click quick link for shop
const shopLink = screen.getByText('محصولات تخصصی ۲۰۲۴');
fireEvent.click(shopLink);
expect(handleShopNavigate).toHaveBeenCalled();
// Click quick link for blog
const blogLink = screen.getByText('مجله سلامت پت (وبلاگ)');
fireEvent.click(blogLink);
expect(handleNavigate).toHaveBeenCalledWith('blog');
// Click B2B link
const b2bLink = screen.getByText('پنل سفارش عمده (B2B)');
fireEvent.click(b2bLink);
expect(handleB2BOpen).toHaveBeenCalled();
});
});