Build the Solaire inventory intelligence MVP
Some checks failed
CI / verify (push) Has been cancelled

Add the tenant-ready dashboard, freshness and pricing analytics, mock integration adapters, persistence schema, and verification tooling needed for the initial pilot.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-25 12:16:52 -07:00
parent bf336f8d15
commit 135be480e5
58 changed files with 7884 additions and 265 deletions

25
tests/freshness.test.ts Normal file
View File

@@ -0,0 +1,25 @@
import { describe, expect, it } from "vitest";
import { calculateFreshness, freshnessStatus } from "@/domain/freshness";
describe("freshness scoring", () => {
const asOf = new Date("2026-07-25T12:00:00Z");
it("returns a fresh score for recently received stock", () => {
expect(calculateFreshness("2026-07-23T12:00:00Z", 10, asOf)).toMatchObject({
ageDays: 2,
remainingDays: 8,
score: 80,
status: "fresh",
});
});
it("marks the threshold states consistently", () => {
expect(freshnessStatus(45)).toBe("watch");
expect(freshnessStatus(20)).toBe("at_risk");
expect(freshnessStatus(0)).toBe("expired");
});
it("never emits a negative freshness score", () => {
expect(calculateFreshness("2026-07-01T12:00:00Z", 7, asOf).score).toBe(0);
});
});