import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, act } from '@testing-library/react';

vi.mock('@umijs/max');
vi.mock('@/services/api');

import { smokeTest } from '../../../../test/smoke';
import Page from './index';

describe('Inventory / Checks page', () => {
  beforeEach(() => {
    vi.clearAllMocks();
  });

  smokeTest(Page);

  it('renders 创建盘点单 toolbar button', async () => {
    render(<Page />);
    await act(async () => {
      await Promise.resolve();
      await Promise.resolve();
    });
    expect(screen.getByRole('button', { name: /创建盘点单/ })).toBeInTheDocument();
  });

  it('renders 库存盘点 table header', async () => {
    render(<Page />);
    await act(async () => {
      await Promise.resolve();
      await Promise.resolve();
    });
    expect(screen.getByText('库存盘点')).toBeInTheDocument();
  });
});
