Standort Shop mit Unterauswahl; C-Level nur als Code; Sonstige im Import
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m26s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m22s
CI / Ausrollen (push) Successful in 7s

Standort: locations.parent_id, eine Ebene. Neu "Shop" mit sechs Shops
(Shop W17, Shop Wodo, Shop Parndorf, Shop Donaupark, Shop W1, Shop Wien
Hauptbahnhof). Personen sitzen nur auf Standorten ohne Unterstandorte;
zwei Trigger halten das auch fuer Import und Nachtlauf fest. Einstellung,
Externe und Versetzung zeigen bei "Shop" eine zweite Auswahl
(StandortAuswahl). Filter in Liste und Berichten und die Importliste
bieten "Shop" selbst nicht an; der Import nennt bei "Shop" die Shops.
rauchtest.sql und vertragsangaben.sql waehlen einen zuweisbaren Standort.

C-Level: ueberall nur der Code (Formular, Akte, Zusammenfassung,
Historie, Berichte, Import). Export ohne Spalte "C-Level Bezeichnung".

Angehoerige und Notfallkontakte im Import wie im Formular: Auswahl als
feste Liste und daneben "Verhaeltnis (Sonstige)" fuer den eigenen Text.
Gespeichert wird bei "Sonstige" der Text; ein Text ohne "Sonstige" ist
ein Fehler. Der Download teilt einen eigenen Text in beide Spalten.

Geprueft: lint, tsc, types:check, npm test, waechter; Migrationen auf
leerer Datenbank zweimal (Nichts anzuwenden), rauchtest.sql,
vertragsangaben.sql; als alpenwerk_app: Einstellung auf "Shop" abgewiesen,
auf "Shop W17" angenommen, Wechsel auf "Shop" abgewiesen, auf "Shop Wodo"
angenommen, Unterstandort unter einem Shop abgewiesen.
This commit is contained in:
2026-11-23 11:50:45 +01:00
parent e1ef57d44b
commit 79979216e4
37 changed files with 587 additions and 113 deletions

View File

@@ -35,7 +35,7 @@ vi.mock("@/actions/hireDrafts", () => ({
}));
vi.mock("next/navigation", () => ({ useRouter: () => ({ refresh: vi.fn(), push: vi.fn() }) }));
const LOCATIONS = [{ id: "l1", name: "Wien", country: "Österreich" }];
const LOCATIONS = [{ id: "l1", name: "Wien", country: "Österreich", parent_id: null }];
function zeige(resumeDraft: { id: string; step: number; payload: Record<string, unknown> } | null = null) {
const onClose = vi.fn();

View File

@@ -40,7 +40,7 @@ const POSITION = {
kostenstelle: null,
} as unknown as OpenPositionResolved;
const LOCATIONS = [{ id: "l1", name: "Wien", country: "AT" }];
const LOCATIONS = [{ id: "l1", name: "Wien", country: "AT", parent_id: null }];
/** Ein Entwurf, in dem alles bis einschliesslich Vertrag vollständig ist. */
const VOLLSTAENDIG = {

View File

@@ -0,0 +1,53 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { useState } from "react";
import { describe, expect, it } from "vitest";
import { StandortAuswahl } from "@/components/employees/StandortAuswahl";
const STANDORTE = [
{ id: "hernals", name: "Wien-Hernals", country: "Österreich", parent_id: null },
{ id: "shop", name: "Shop", country: "Österreich", parent_id: null },
{ id: "w17", name: "Shop W17", country: "Österreich", parent_id: "shop" },
{ id: "wodo", name: "Shop Wodo", country: "Österreich", parent_id: "shop" },
];
function Formular({ start = "" }: { start?: string }) {
const [wert, setWert] = useState(start);
return (
<>
<StandortAuswahl required value={wert} onChange={setWert} standorte={STANDORTE} />
<output data-testid="stand">{wert}</output>
</>
);
}
describe("StandortAuswahl", () => {
it("zeigt zuerst nur die oberste Ebene", () => {
render(<Formular />);
const optionen = Array.from((screen.getByLabelText(/^Standort/) as HTMLSelectElement).options).map((o) => o.value);
expect(optionen).toEqual(["", "hernals", "shop"]);
expect(screen.queryByLabelText(/^Shop/)).not.toBeInTheDocument();
});
it("verlangt unter „Shop“ den einzelnen Shop und meldet erst ihn", () => {
render(<Formular />);
fireEvent.change(screen.getByLabelText(/^Standort/), { target: { value: "shop" } });
expect(screen.getByTestId("stand").textContent).toBe("");
const shops = screen.getByLabelText(/^Shop/) as HTMLSelectElement;
expect(Array.from(shops.options).map((o) => o.text)).toEqual(["Bitte wählen…", "W17", "Wodo"]);
fireEvent.change(shops, { target: { value: "wodo" } });
expect(screen.getByTestId("stand").textContent).toBe("wodo");
});
it("öffnet einen gespeicherten Shop mit beiden Auswahlen", () => {
render(<Formular start="w17" />);
expect((screen.getByLabelText(/^Standort/) as HTMLSelectElement).value).toBe("shop");
expect((screen.getByLabelText(/^Shop/) as HTMLSelectElement).value).toBe("w17");
});
it("schliesst die zweite Auswahl beim Wechsel auf einen gewöhnlichen Standort", () => {
render(<Formular start="w17" />);
fireEvent.change(screen.getByLabelText(/^Standort/), { target: { value: "hernals" } });
expect(screen.getByTestId("stand").textContent).toBe("hernals");
expect(screen.queryByLabelText(/^Shop/)).not.toBeInTheDocument();
});
});

View File

@@ -60,7 +60,7 @@ const MIT_STAATSBUERGERSCHAFT = { ...EXTERN, nationality: "Deutschland" } as Emp
function zeige(employee: EmployeeRow = MIT_STAATSBUERGERSCHAFT) {
return render(
<ToastProvider>
<UebernahmeWizard open onClose={() => {}} employee={employee} locations={[{ id: "l1", name: "Wien", country: "Österreich" }]} />
<UebernahmeWizard open onClose={() => {}} employee={employee} locations={[{ id: "l1", name: "Wien", country: "Österreich", parent_id: null }]} />
</ToastProvider>
);
}
@@ -102,7 +102,7 @@ describe("Übernahme", () => {
open
onClose={() => {}}
employee={{ ...EXTERN, birth_date: "2090-01-01" } as EmployeeRow}
locations={[{ id: "l1", name: "Wien", country: "Österreich" }]}
locations={[{ id: "l1", name: "Wien", country: "Österreich", parent_id: null }]}
/>
</ToastProvider>
);

View File

@@ -90,9 +90,9 @@ describe("VertragTab — Merkmale", () => {
expect(wertZu("Betriebsrat")).toBe("Nein");
});
it("zeigt C-Level mit Code und Bezeichnung", () => {
it("zeigt C-Level als Code", () => {
render(<VertragTab employee={mitarbeiter({ c_level: "C4" })} />);
expect(wertZu("C-Level")).toBe("C4 – Teamleitung");
expect(wertZu("C-Level")).toBe("C4");
});
it("zeigt bei C-Level ohne Angabe einen Strich", () => {