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('Purchase / Receipts page', () => {
  beforeEach(() => {
    vi.clearAllMocks();
  });

  smokeTest(Page);

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

  it('renders status and receipt date column headers', async () => {
    render(<Page />);
    await act(async () => {
      await Promise.resolve();
      await Promise.resolve();
    });
    expect(screen.getByText('入库单号')).toBeInTheDocument();
    expect(screen.getByText('状态')).toBeInTheDocument();
  });
});
