- consoles/admin/ → layouts/admin-layout/ - consoles/workbench/ → layouts/workbench-layout/ + features/chat/ - pages/ → features/ (dashboard, models, projects, not-found) - components/ → shared/components/ - hooks/ → shared/hooks/ - utils/ → shared/utils/ - 更新所有 import 路径 (src/web/ + tests/web/) - 更新开发文档 (README.md, frontend.md, architecture.md)
26 lines
838 B
TypeScript
26 lines
838 B
TypeScript
/* eslint-disable @typescript-eslint/require-await */
|
|
import { screen } from "@testing-library/react";
|
|
import { describe, expect, test } from "bun:test";
|
|
import { createElement } from "react";
|
|
|
|
import { DashboardPage } from "../../../src/web/features/dashboard";
|
|
import { renderWithProviders } from "../test-utils";
|
|
|
|
describe("DashboardPage", () => {
|
|
test("渲染欢迎信息", () => {
|
|
window.fetch = (async () => {
|
|
return new Response(
|
|
JSON.stringify({ ok: true, service: "test-app", timestamp: new Date().toISOString(), version: "0.1.0" }),
|
|
{
|
|
headers: { "Content-Type": "application/json" },
|
|
status: 200,
|
|
},
|
|
);
|
|
}) as unknown as typeof fetch;
|
|
|
|
renderWithProviders(createElement(DashboardPage));
|
|
|
|
expect(screen.getByText(/欢迎使用/)).not.toBeNull();
|
|
});
|
|
});
|