import { describe, expect, it, vi } from 'vitest';
import { render } from 'ink-testing-library';
import React from 'react';
import { ConfirmDialog } from '../../components/shared/ConfirmDialog.js';

describe('ConfirmDialog', () => {
  it('renders the message', () => {
    const { lastFrame } = render(
      React.createElement(ConfirmDialog, {
        message: 'Benutzer sperren?',
        onConfirm: vi.fn(),
        onCancel: vi.fn(),
      }),
    );
    expect(lastFrame()).toContain('Benutzer sperren?');
  });

  it('renders J/N hint', () => {
    const { lastFrame } = render(
      React.createElement(ConfirmDialog, {
        message: 'Test?',
        onConfirm: vi.fn(),
        onCancel: vi.fn(),
      }),
    );
    expect(lastFrame()).toContain('[J]');
    expect(lastFrame()).toContain('[N]');
  });

  it('renders Bestätigung label', () => {
    const { lastFrame } = render(
      React.createElement(ConfirmDialog, {
        message: 'Aktion bestätigen?',
        onConfirm: vi.fn(),
        onCancel: vi.fn(),
      }),
    );
    expect(lastFrame()).toContain('Bestätigung');
  });
});
