Files
Wabenhain/src/lib/settings-tabs.test.ts
T
Nick SzaunigandClaude Opus 5.5 de82ad0233
Docker Image bauen und veroeffentlichen / build-and-push (push) Successful in 2m26s
feat(admin): settings page with tabs, system checks and email test
"Inhalte" becomes Admin -> Einstellungen, grouped into tabs so each
area stands on its own: Firma & Versand, Marke, Startseite, Seiten,
Social Media, Rechtstexte and System & Tests. Tabs are plain links
(?reiter=...), bookmarkable and usable without JavaScript; saving
returns to the same tab.

System & Tests brings everything that checks the running shop into one
place:
- integration overview (Stripe, Stripe webhook, Microsoft 365 mail,
  Microsoft sign-in, Turnstile, Google reviews, DHL, ApiCore): only
  whether each is set up and the names of missing variables, never a
  value; warns when Stripe runs on test keys or mixes test/live
- the email test, now with the IPv4 network checks for
  smtp.office365.com:587 and login.microsoftonline.com:443

/admin/inhalte and /admin/e-mail-test redirect to the new page; the
separate "E-Mail-Test" menu entry is gone. The tab parameter and the
saved group are validated against a fixed list before they are used in
a redirect. Docs point to the new location and cover the ENETUNREACH
(IPv6) case.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-27 00:07:34 +02:00

26 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { CONTENT_REGISTRY } from "./content-registry";
import { SETTINGS_TABS, parseSettingsTab, settingsPathForGroup } from "./settings-tabs";
describe("settings tabs", () => {
it("places every content group on exactly one tab", () => {
const groups = new Set(CONTENT_REGISTRY.map((f) => f.group));
for (const group of groups) {
expect(SETTINGS_TABS.filter((tab) => (tab.groups as readonly string[]).includes(group))).toHaveLength(1);
}
});
it("falls back to the first tab for unknown or missing values", () => {
expect(parseSettingsTab(undefined)).toBe("firma");
expect(parseSettingsTab("../../etc")).toBe("firma");
expect(parseSettingsTab(["system"])).toBe("firma");
expect(parseSettingsTab("system")).toBe("system");
});
it("returns to the tab of the saved group", () => {
expect(settingsPathForGroup("shipping")).toBe("/admin/einstellungen?reiter=firma");
expect(settingsPathForGroup("legal")).toBe("/admin/einstellungen?reiter=recht");
expect(settingsPathForGroup("evil?x=1")).toBe("/admin/einstellungen");
});
});