Files
goodgo-platform/apps/web/components/providers/__tests__/notifications-provider.spec.tsx
Ho Ngoc Hai f5118244b7 fix(a11y): resolve serious accessibility issues on search page (GOO-110)
- Add aria-hidden="true" to all decorative inline SVGs (bookmark, view-mode, funnel, checkmark)
- Convert save-search popover to proper dialog: role="dialog", aria-modal, focus trap, Escape key, focus return to trigger
- Add aria-pressed on list/map/split view-mode toggle buttons
- Add aria-expanded + aria-controls on mobile filter toggle button
- Add role="status" + aria-label="Đang tải..." on Suspense fallback

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-24 10:26:50 +07:00

31 lines
873 B
TypeScript

import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { NotificationsProvider } from '../notifications-provider';
const useSocketNotificationsMock = vi.fn();
vi.mock('@/lib/hooks/use-socket-notifications', () => ({
useSocketNotifications: () => useSocketNotificationsMock(),
}));
describe('NotificationsProvider', () => {
it('renders children', () => {
render(
<NotificationsProvider>
<div>child</div>
</NotificationsProvider>,
);
expect(screen.getByText('child')).toBeInTheDocument();
});
it('initializes socket notifications hook on mount', () => {
useSocketNotificationsMock.mockClear();
render(
<NotificationsProvider>
<span>x</span>
</NotificationsProvider>,
);
expect(useSocketNotificationsMock).toHaveBeenCalled();
});
});