test: centralize evidence passport states
This commit is contained in:
@@ -28,6 +28,15 @@ export function freshnessStatus(value: string | null | undefined, now = Date.now
|
||||
return now - timestamp > 48 * 60 * 60 * 1000 ? "stale" : "fresh";
|
||||
}
|
||||
|
||||
export type PassportStatus = "verified" | "unverified" | "incomplete" | "insufficient" | "blocked";
|
||||
export type PassportDisplayStatus = PassportStatus | "conflict" | "stale";
|
||||
|
||||
export function passportDisplayStatus(status: PassportStatus, freshness: "fresh" | "stale" | "unknown", hasConflicts: boolean): PassportDisplayStatus {
|
||||
if (hasConflicts) return "conflict";
|
||||
if (status === "verified" && freshness === "stale") return "stale";
|
||||
return status;
|
||||
}
|
||||
|
||||
export function sourceStatusLabel(status: string) {
|
||||
const labels: Record<string, string> = {
|
||||
healthy: "Актуален", stale: "Данные устарели", temporarily_limited: "Источник временно ограничен",
|
||||
|
||||
Reference in New Issue
Block a user