Hinweise optimiert
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { RouteWarning } from "@watermaps/shared";
|
||||
import {
|
||||
isOpenRouteWarning,
|
||||
isRetainedRouteWarning
|
||||
} from "../src/lib/route-warnings";
|
||||
|
||||
describe("route warning filters", () => {
|
||||
it("filters every retired fairway and depth warning code centrally", () => {
|
||||
const retiredCodes = [
|
||||
"FAIRWAY_ROUTE",
|
||||
"FAIRWAY_DATA_NOT_OFFICIAL",
|
||||
"DEPTH_UNKNOWN",
|
||||
"DEPTH_PARTIAL",
|
||||
"NO_KNOWN_DEPTH",
|
||||
"DEPTH_TOO_SHALLOW"
|
||||
];
|
||||
|
||||
for (const code of retiredCodes) {
|
||||
const warning: RouteWarning = {
|
||||
code,
|
||||
severity: "critical",
|
||||
message: `Alter Hinweis ${code}`
|
||||
};
|
||||
expect(isRetainedRouteWarning(warning)).toBe(false);
|
||||
expect(isOpenRouteWarning(warning)).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it("retains current warnings and only counts non-informational ones as open", () => {
|
||||
expect(
|
||||
isRetainedRouteWarning({
|
||||
code: "ROUTE_SEARCH_LIMITED",
|
||||
severity: "caution",
|
||||
message: "Suche begrenzt"
|
||||
})
|
||||
).toBe(true);
|
||||
expect(
|
||||
isOpenRouteWarning({
|
||||
code: "ROUTE_SEARCH_LIMITED",
|
||||
severity: "caution",
|
||||
message: "Suche begrenzt"
|
||||
})
|
||||
).toBe(true);
|
||||
expect(
|
||||
isOpenRouteWarning({
|
||||
code: "ROUTING_SOURCE",
|
||||
severity: "info",
|
||||
message: "Routingquelle"
|
||||
})
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user