canina/frontend/application/components/__tests__/Footer.test.tsx
parsa aghaei 8d1b786a24
All checks were successful
Deploy Canina / deploy (push) Successful in 1m50s
chore(brand): rename all Persian occurrences of کانینا to کنینا across the project
2026-08-16 16:40:08 +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();
});
});