- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import TickerBanner from '../TickerBanner';
|
|
import { useSettingsStore } from '../../lib/store/settingsStore';
|
|
|
|
describe('TickerBanner Component', () => {
|
|
beforeEach(() => {
|
|
useSettingsStore.setState({
|
|
texts: {
|
|
shipping_notice: 'ارسال رایگان برای سفارشهای ویژه کنینا',
|
|
site_logo_text_en: 'Canina',
|
|
site_logo_text_fa: 'ایران',
|
|
},
|
|
});
|
|
});
|
|
|
|
it('renders announcement text from settingsStore', () => {
|
|
render(<TickerBanner />);
|
|
const notices = screen.getAllByText(/ارسال رایگان برای سفارشهای ویژه کنینا/);
|
|
expect(notices.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('renders default brand title in mobile view when logo is text', () => {
|
|
render(<TickerBanner />);
|
|
expect(screen.getByText('Canina')).toBeInTheDocument();
|
|
expect(screen.getByText('ایران')).toBeInTheDocument();
|
|
});
|
|
});
|