import { screen } from "@testing-library/react";
import { describe, expect, test } from "bun:test";
import { createElement } from "react";

import { Sidebar } from "../../../../src/web/components/Sidebar";
import { renderWithProviders } from "../../test-utils";

describe("Sidebar", () => {
  test("渲染菜单项", () => {
    renderWithProviders(createElement(Sidebar, { collapsed: false }));

    expect(screen.getByText("仪表盘")).not.toBeNull();
    expect(screen.getByText("用户管理")).not.toBeNull();
    expect(screen.getByText("系统设置")).not.toBeNull();
  });

  test("折叠状态下仍渲染菜单项", () => {
    renderWithProviders(createElement(Sidebar, { collapsed: true }));

    expect(screen.getByText("仪表盘")).not.toBeNull();
    expect(screen.getByText("用户管理")).not.toBeNull();
    expect(screen.getByText("系统设置")).not.toBeNull();
  });
});
