import { renderToStaticMarkup } from 'react-dom/server';
import { describe, expect, it, vi } from 'vitest';
import { EmergencyLoginPage } from './EmergencyLoginPage';

describe('EmergencyLoginPage', () => {
  it('renders only the local account form for emergency access', () => {
    const html = renderToStaticMarkup(
      <EmergencyLoginPage
        loginForm={{ account: '', password: '' }}
        state="idle"
        onLoginChange={vi.fn()}
        onSubmitLogin={vi.fn()}
      />,
    );

    expect(html).toContain('本地应急登录');
    expect(html).toContain('统一认证中心不可用');
    expect(html).toContain('用户名或邮箱');
    expect(html).toContain('current-password');
    expect(html).not.toContain('注册账号');
    expect(html).not.toContain('外部 Token');
    expect(html).not.toContain('使用统一认证中心登录');
  });
});
