Hinweise optimiert
This commit is contained in:
@@ -68,6 +68,71 @@ describe("offline voyage storage", () => {
|
||||
expect(listOfflineVoyages(localStorage)).toEqual([]);
|
||||
});
|
||||
|
||||
it("removes retired warnings and depth fields from legacy offline routes", () => {
|
||||
const record = createOfflineVoyageRecord(
|
||||
{ route: routeFixture },
|
||||
{ id: "legacy-voyage", savedAt: "2026-07-19T12:00:00.000Z" }
|
||||
);
|
||||
const legacyRecord = {
|
||||
...record,
|
||||
route: {
|
||||
...record.route,
|
||||
minKnownDepthM: null,
|
||||
unknownDepthRatio: 1,
|
||||
warnings: [
|
||||
{
|
||||
code: "FAIRWAY_ROUTE",
|
||||
severity: "info",
|
||||
message: "Alter Graph-Hinweis"
|
||||
},
|
||||
{
|
||||
code: "FAIRWAY_DATA_NOT_OFFICIAL",
|
||||
severity: "caution",
|
||||
message: "Alter Daten-Hinweis"
|
||||
},
|
||||
{
|
||||
code: "DEPTH_UNKNOWN",
|
||||
severity: "caution",
|
||||
message: "Alter Tiefenpunkt-Hinweis"
|
||||
},
|
||||
{
|
||||
code: "DEPTH_PARTIAL",
|
||||
severity: "caution",
|
||||
message: "Alter Teil-Tiefenhinweis"
|
||||
},
|
||||
{
|
||||
code: "NO_KNOWN_DEPTH",
|
||||
severity: "caution",
|
||||
message: "Alter Unbekannt-Hinweis"
|
||||
},
|
||||
{
|
||||
code: "DEPTH_TOO_SHALLOW",
|
||||
severity: "critical",
|
||||
message: "Alter Flachwasser-Hinweis"
|
||||
},
|
||||
{
|
||||
code: "ROUTE_SEARCH_LIMITED",
|
||||
severity: "caution",
|
||||
message: "Suche begrenzt"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
localStorage.setItem(OFFLINE_VOYAGES_STORAGE_KEY, JSON.stringify([legacyRecord]));
|
||||
|
||||
const restored = loadOfflineVoyage("legacy-voyage", localStorage);
|
||||
|
||||
expect(restored?.route.warnings).toEqual([
|
||||
{
|
||||
code: "ROUTE_SEARCH_LIMITED",
|
||||
severity: "caution",
|
||||
message: "Suche begrenzt"
|
||||
}
|
||||
]);
|
||||
expect(restored?.route).not.toHaveProperty("minKnownDepthM");
|
||||
expect(restored?.route).not.toHaveProperty("unknownDepthRatio");
|
||||
});
|
||||
|
||||
it("rejects unsafe route coordinates before writing", () => {
|
||||
expect(() => createOfflineVoyageRecord({
|
||||
route: {
|
||||
@@ -91,8 +156,6 @@ const routeFixture: RouteResult = {
|
||||
durationMinutes: 120,
|
||||
eta: "2026-07-20T08:00:00.000Z",
|
||||
warnings: [{ code: "NOT_OFFICIAL", severity: "caution", message: "Nicht amtlich" }],
|
||||
minKnownDepthM: null,
|
||||
unknownDepthRatio: 1,
|
||||
dataSources: ["OSM"],
|
||||
routingMode: "fairway",
|
||||
routeSnaps: {
|
||||
@@ -115,8 +178,6 @@ const routeFixture: RouteResult = {
|
||||
distanceNm: 160,
|
||||
eta: null,
|
||||
warnings: [],
|
||||
minKnownDepthM: null,
|
||||
unknownDepthRatio: 1,
|
||||
dataSources: ["OSM"]
|
||||
}]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user