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

import { NotFoundPage } from "../../../src/web/pages/404";
import { renderWithProviders } from "../test-utils";

describe("NotFoundPage", () => {
  test("渲染 404 页面", () => {
    renderWithProviders(createElement(NotFoundPage));

    expect(screen.getByText("404")).not.toBeNull();
    expect(screen.getByText("您访问的页面不存在")).not.toBeNull();
    expect(screen.getByRole("button", { name: "返回首页" })).not.toBeNull();
  });

  test("返回首页按钮存在且可点击", () => {
    renderWithProviders(createElement(NotFoundPage));

    const button = screen.getByRole("button", { name: "返回首页" });
    expect(button).not.toBeNull();
  });
});
