Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

test(web): preserve page title cleanup with instance names

Tineff067423128
diff --git a/apps/web/src/components/page-title.test.tsx b/apps/web/src/components/page-title.test.tsx
index e7345218c..2395eda0d 100644
--- a/apps/web/src/components/page-title.test.tsx
+++ b/apps/web/src/components/page-title.test.tsx
@@ -1,5 +1,6 @@
import { cleanup, render } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it } from "vite-plus/test";
+import { useInstanceNameStore } from "@/store/instance-name";
import PageTitle from "./page-title";
describe("PageTitle", () => {
@@ -7,7 +8,18 @@ describe("PageTitle", () => {
document.title = "Kaneo";
});
- afterEach(cleanup);
+ afterEach(() => {
+ cleanup();
+ useInstanceNameStore.setState({ instanceName: "Kaneo" });
+ });
+
+ it("uses the custom instance name and restores the fallback on unmount", () => {
+ useInstanceNameStore.setState({ instanceName: "Acme" });
+ const { unmount } = render(<PageTitle title="Settings" />);
+ expect(document.title).toBe("Settings | Acme");
+ unmount();
+ expect(document.title).toBe("Kaneo");
+ });
it("sets the document title", () => {
render(<PageTitle title="MFP-1 Drag this card" />);