import { render, screen } from '@testing-library/react';
import { Button, Typography } from '@douyinfe/semi-ui';
import { expect, test } from 'vitest';
import { WorkspaceCommandBar } from './WorkspaceCommandBar';

test('renders a compact Semi workspace command hierarchy', () => {
  const view = render(<WorkspaceCommandBar
    className="custom-command"
    ariaLabel="测试工作区操作"
    title="测试工作区"
    description="说明当前任务和数据范围"
    status="12 条"
    meta={<Typography.Text type="tertiary">刚刚更新</Typography.Text>}
    actions={<Button theme="solid">执行</Button>}
  />);

  expect(screen.getByRole('heading', { name: '测试工作区', level: 5 })).toBeInTheDocument();
  expect(screen.getByLabelText('测试工作区操作')).toHaveClass('v2-workspace-command-bar', 'custom-command');
  expect(screen.getByText('12 条').closest('.semi-tag')).toBeInTheDocument();
  expect(screen.getByRole('button', { name: '执行' })).toHaveClass('semi-button');
  expect(view.container.querySelector('.v2-workspace-command-copy')).toHaveTextContent('说明当前任务和数据范围');
});
