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

View File

@@ -0,0 +1,28 @@
import { describe, expect, it } from "vitest";
import { getDashboardData } from "@/domain/analytics";
import { marginPercent } from "@/domain/recommendations";
describe("pricing recommendations", () => {
const data = getDashboardData();
it("protects every product margin floor", () => {
for (const recommendation of data.recommendations) {
const product = data.inventory.find((item) => item.productId === recommendation.productId)!.product;
expect(marginPercent(product, recommendation.recommendedLow))
.toBeGreaterThanOrEqual(product.marginFloorPercent - 0.01);
}
});
it("provides explanations and bounded ranges", () => {
for (const recommendation of data.recommendations) {
expect(recommendation.reason.length).toBeGreaterThan(20);
expect(recommendation.recommendedHigh).toBeGreaterThanOrEqual(recommendation.recommendedLow);
expect(recommendation.recommendedHigh).toBeLessThanOrEqual(recommendation.currentPrice);
}
});
it("contains actionable aging-stock recommendations", () => {
expect(data.recommendations.some((item) => item.type === "markdown")).toBe(true);
expect(data.recommendations.some((item) => item.type === "promotion")).toBe(true);
});
});