feat: label stale evidence data

This commit is contained in:
ik
2026-09-20 20:21:39 +07:00
parent 1dfe1e8ba4
commit 5a8174b11e
6 changed files with 25 additions and 9 deletions
+8 -1
View File
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import test from "node:test";
import { activityLevel, plural } from "../../src/lib/presentation.ts";
import { activityLevel, freshnessStatus, plural } from "../../src/lib/presentation.ts";
import { fishVisualFamily } from "../../src/lib/fish-visuals.ts";
import { tackleVisualKind, tackleVisualTone } from "../../src/lib/tackle-visuals.ts";
import { waterbodyVisual } from "../../src/lib/waterbody-visuals.ts";
@@ -23,6 +23,13 @@ test("Russian plural forms cover common and exceptional endings", () => {
);
});
test("freshness status is explicit and deterministic around the 48-hour boundary", () => {
const now = Date.parse("2026-09-20T12:00:00Z");
assert.equal(freshnessStatus("2026-09-20T11:59:00Z", now), "fresh");
assert.equal(freshnessStatus("2026-09-18T11:59:00Z", now), "stale");
assert.equal(freshnessStatus(null, now), "unknown");
});
test("fish visual families follow body type instead of a name hash", () => {
assert.deepEqual(
["Щука", "Озёрная форель", "Карп", "Окунь", "Сом", "Угорь", "Палтус", "Треска", "Неизвестная рыба"].map(fishVisualFamily),