Hinweise optimiert
Test and publish container images / test (push) Successful in 2m27s
Test and publish container images / publish (push) Failing after 4s

This commit is contained in:
BuTzZ
2026-07-27 13:04:32 +02:00
parent 9813a1fafb
commit b98ec8bc6f
34 changed files with 500 additions and 399 deletions
+85 -5
View File
@@ -1,5 +1,5 @@
import "@testing-library/jest-dom/vitest";
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
import { act, cleanup, fireEvent, render, screen, within } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { RoutePlanner } from "../src/components/RoutePlanner";
import { DEFAULT_BOAT_PROFILE } from "../src/lib/boat-profile";
@@ -416,6 +416,7 @@ describe("RoutePlanner", () => {
);
expect(screen.getByText("Routenergebnis")).toBeVisible();
expect(screen.getByText("Hinweise (2)")).toBeVisible();
expect(screen.getByText("Brücke ist zu niedrig.")).toBeVisible();
expect(screen.getByText("Wind aufmerksam beobachten.")).toBeVisible();
expect(screen.queryByRole("button", { name: "Start auf Karte setzen" })).not.toBeInTheDocument();
@@ -426,6 +427,89 @@ describe("RoutePlanner", () => {
expect(screen.getByRole("button", { name: "Zur Route" })).toBeVisible();
});
it("filters retired fairway and depth warnings from route results", () => {
const result = {
...routeOption("primary", "Hauptroute", 24.48),
warnings: [
{
code: "FAIRWAY_ROUTE",
severity: "info" as const,
message: "Entfernter Graph-Hinweis."
},
{
code: "FAIRWAY_DATA_NOT_OFFICIAL",
severity: "caution" as const,
message: "Entfernter Daten-Hinweis."
},
{
code: "ROUTE_SEARCH_LIMITED",
severity: "caution" as const,
message: "Die Snap-Suche wurde begrenzt."
},
{
code: "DEPTH_PARTIAL",
severity: "caution" as const,
message: "Entfernter Teil-Tiefenhinweis."
},
{
code: "NO_KNOWN_DEPTH",
severity: "caution" as const,
message: "Entfernter Unbekannt-Hinweis."
},
{
code: "DEPTH_UNKNOWN",
severity: "caution" as const,
message: "Entfernter Tiefenpunkt-Hinweis."
},
{
code: "DEPTH_TOO_SHALLOW",
severity: "critical" as const,
message: "Entfernter Flachwasser-Hinweis."
}
]
};
render(
<RoutePlanner
startPoint={{ lat: 53.4647, lon: 7.474 }}
gpsPosition={null}
destination={{ lat: 53.5147, lon: 8.1203 }}
result={result}
routeOptions={[result]}
weatherReport={null}
weatherLoading={false}
weatherError={null}
loading={false}
error={null}
pickMode={null}
onSubmit={vi.fn()}
onPickStart={vi.fn()}
onPickDestination={vi.fn()}
onClearStart={vi.fn()}
onClearDestination={vi.fn()}
onUseGpsAsStart={vi.fn()}
onSelectRoute={vi.fn()}
onCollapse={vi.fn()}
embedded
/>
);
const warnings = screen.getByRole("region", { name: "Routing-Hinweise" });
expect(within(warnings).getByText("Hinweise (1)")).toBeVisible();
expect(within(warnings).getByText("Die Snap-Suche wurde begrenzt.")).toBeVisible();
expect(screen.queryByText("Entfernter Graph-Hinweis.")).not.toBeInTheDocument();
expect(screen.queryByText("Entfernter Daten-Hinweis.")).not.toBeInTheDocument();
expect(screen.queryByText("Entfernter Teil-Tiefenhinweis.")).not.toBeInTheDocument();
expect(screen.queryByText("Entfernter Unbekannt-Hinweis.")).not.toBeInTheDocument();
expect(screen.queryByText("Entfernter Tiefenpunkt-Hinweis.")).not.toBeInTheDocument();
expect(screen.queryByText("Entfernter Flachwasser-Hinweis.")).not.toBeInTheDocument();
expect(screen.queryByText(/Routingdetails/)).not.toBeInTheDocument();
expect(screen.getByText("Hauptroute").closest(".route-result")).toHaveAttribute(
"data-severity",
"caution"
);
});
it("shows the route weather report after a route was calculated", () => {
render(
<RoutePlanner
@@ -437,8 +521,6 @@ describe("RoutePlanner", () => {
distanceNm: 4.2,
eta: null,
warnings: [],
minKnownDepthM: null,
unknownDepthRatio: 1,
dataSources: [],
routingMode: "fairway"
}}
@@ -608,8 +690,6 @@ function routeOption(id: string, name: string, distanceNm: number) {
distanceNm,
eta: "2026-07-13T14:00:00.000Z",
warnings: [],
minKnownDepthM: null,
unknownDepthRatio: 1,
dataSources: [],
routingMode: "fairway" as const
};