feat(webui): show the full token-usage picture in settings (#6638)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-12 18:13:06 +08:00
1 parent b49218b6a3
commit e6b23c7356
42 files changed
+1116 -342

No files matched your search

+14
View File
@@ -662,6 +662,20 @@ describe("App layout", () => {
expect(asideClassNames.some((cls) => cls.includes("lg:block"))).toBe(true);
});
it("loads settings once when opening the overview directly", async () => {
window.location.hash = "#/settings";
mockFetchRoutes({ "/api/settings": baseSettingsPayload(), "/api/settings/usage": { days: [] } });
render(<App />);
await act(async () => { await import("@/components/settings/SettingsView"); });
expect(await screen.findByRole("navigation", { name: "Settings sections" })).toBeInTheDocument();
expect(await screen.findByText("Token usage")).toBeInTheDocument();
const reads = () => vi.mocked(fetch).mock.calls.filter(([url]) => String(url) === "/api/settings");
expect(reads()).toHaveLength(1);
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
await screen.findByRole("navigation", { name: "Sidebar navigation" });
expect(reads()).toHaveLength(1);
});
it("uses one main landmark and a page heading in desktop settings", async () => {
mockFetchRoutes({ "/api/settings": baseSettingsPayload() });
const { container } = render(<App />);