Fix TypeScript typecheck errors
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-30 15:56:06 +01:00
parent 916b204688
commit b1f9f7cee0
42 changed files with 324 additions and 72 deletions

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
const fixtures = vi.hoisted(() => ({
event: {
@@ -74,7 +75,11 @@ vi.mock('../components/MobileShell', () => ({
vi.mock('../components/Primitives', () => ({
MobileCard: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
CTAButton: ({ label }: { label: string }) => <button type="button">{label}</button>,
CTAButton: ({ label, onPress, disabled }: { label: string; onPress?: () => void; disabled?: boolean }) => (
<button type="button" onClick={onPress} disabled={disabled}>
{label}
</button>
),
PillBadge: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));
@@ -116,6 +121,7 @@ vi.mock('../theme', () => ({
}));
import MobileQrPrintPage from '../QrPrintPage';
import { createQrInvite } from '../../api';
describe('MobileQrPrintPage', () => {
it('renders QR overview content', async () => {
@@ -125,4 +131,19 @@ describe('MobileQrPrintPage', () => {
expect(screen.getByText('Schritt 1: Format wählen')).toBeInTheDocument();
expect(screen.getAllByText('Neuen QR-Link erstellen').length).toBeGreaterThan(0);
});
it('requires confirmation before creating a new QR link', async () => {
const user = userEvent.setup();
const confirmSpy = vi.fn().mockReturnValue(false);
window.confirm = confirmSpy;
render(<MobileQrPrintPage />);
const createButton = await screen.findByRole('button', { name: 'Neuen QR-Link erstellen' });
await user.click(createButton);
expect(confirmSpy).toHaveBeenCalled();
expect(confirmSpy).toHaveBeenCalledWith(expect.stringContaining('Ausdrucke'));
expect(createQrInvite).not.toHaveBeenCalled();
});
});