chore(test): 5 Geister-Tests entfernt (Komponenten wurden bereits in db4701b als BUG-080/082 unused gelöscht) und Playwright-e2e-Specs aus der Vitest-Einsammelung ausgeschlossen — sie gehören zum eigenen Runner mit eigener Konfiguration

This commit is contained in:
Agent Zero
2026-08-27 08:26:27 +02:00
parent 1c52d3e502
commit 5874975ff9
6 changed files with 1 additions and 421 deletions
@@ -1,96 +0,0 @@
/**
* PWA Install Prompt tests — Task 5.24.
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { PWAInstallPrompt } from '@/components/PWAInstallPrompt';
import { getNotificationPermission, isPWAInstalled } from '@/utils/notifications';
// Mock i18n
vi.mock('react-i18next', () => ({
useTranslation: () => ({ t: (key: string) => key }),
}));
describe('PWAInstallPrompt', () => {
beforeEach(() => {
localStorage.clear();
vi.restoreAllMocks();
});
it('renders nothing when no beforeinstallprompt event fires', () => {
render(<PWAInstallPrompt />);
expect(screen.queryByTestId('pwa-install-prompt')).toBeNull();
});
it('shows install prompt when beforeinstallprompt fires', async () => {
render(<PWAInstallPrompt />);
const event = new Event('beforeinstallprompt');
Object.assign(event, {
prompt: vi.fn().mockResolvedValue(undefined),
userChoice: Promise.resolve({ outcome: 'accepted' }),
});
window.dispatchEvent(event);
await waitFor(() => {
expect(screen.getByTestId('pwa-install-prompt')).toBeInTheDocument();
});
expect(screen.getByTestId('pwa-install-btn')).toBeInTheDocument();
expect(screen.getByTestId('pwa-dismiss-btn')).toBeInTheDocument();
});
it('hides when dismiss button is clicked', async () => {
render(<PWAInstallPrompt />);
const event = new Event('beforeinstallprompt');
Object.assign(event, {
prompt: vi.fn().mockResolvedValue(undefined),
userChoice: Promise.resolve({ outcome: 'dismissed' }),
});
window.dispatchEvent(event);
await waitFor(() => {
expect(screen.getByTestId('pwa-install-prompt')).toBeInTheDocument();
});
fireEvent.click(screen.getByTestId('pwa-dismiss-btn'));
await waitFor(() => {
expect(screen.queryByTestId('pwa-install-prompt')).toBeNull();
});
// Should not show again after dismiss (localStorage)
expect(localStorage.getItem('leocrm_pwa_install_dismissed')).toBe('1');
});
it('does not show when already dismissed', () => {
localStorage.setItem('leocrm_pwa_install_dismissed', '1');
render(<PWAInstallPrompt />);
const event = new Event('beforeinstallprompt');
Object.assign(event, {
prompt: vi.fn(),
userChoice: Promise.resolve({ outcome: 'dismissed' }),
});
window.dispatchEvent(event);
expect(screen.queryByTestId('pwa-install-prompt')).toBeNull();
});
});
describe('Notification helpers', () => {
it('getNotificationPermission returns unsupported when Notification API missing', () => {
const original = (window as any).Notification;
delete (window as any).Notification;
expect(getNotificationPermission()).toBe('unsupported');
(window as any).Notification = original;
});
it('isPWAInstalled returns false in browser mode', () => {
expect(isPWAInstalled()).toBe(false);
});
});