744e9c6cda
The workflow analytics now render under the Analytics tab's Workflow sub-tab; ?tab= and ?sub= deep-link the Dashboard, /workflows redirects there, and the sidebar drops its Workflows item.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/**
|
|
* @file DocumentTitle.test.tsx
|
|
* @description Guards the route→browser-tab-title map against missing i18n keys:
|
|
* a key that does not exist renders as the raw key (the "run" bug), so each route
|
|
* is asserted against its translated label.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
import { describe, it, expect, beforeAll } from "vitest";
|
|
import { render } from "@testing-library/react";
|
|
import { MemoryRouter } from "react-router-dom";
|
|
import i18n from "i18next";
|
|
import { DocumentTitle } from "../DocumentTitle";
|
|
|
|
const titleFor = (path: string) => {
|
|
render(
|
|
<MemoryRouter initialEntries={[path]}>
|
|
<DocumentTitle />
|
|
</MemoryRouter>
|
|
);
|
|
return document.title;
|
|
};
|
|
|
|
describe("DocumentTitle", () => {
|
|
beforeAll(async () => {
|
|
await i18n.changeLanguage("en");
|
|
});
|
|
|
|
it("titles the workspace route with its nav label, not the raw key", () => {
|
|
expect(titleFor("/workspace")).toMatch(/^Workspace · /);
|
|
});
|
|
|
|
it("titles the other top-level routes", () => {
|
|
expect(titleFor("/")).toMatch(/^Dashboard · /);
|
|
expect(titleFor("/sessions")).toMatch(/^Sessions · /);
|
|
expect(titleFor("/settings")).toMatch(/^Settings · /);
|
|
});
|
|
});
|