Add Ollama status checks and Docker deployment
This commit is contained in:
@@ -88,4 +88,51 @@ describe("generateMonthlyInsight", () => {
|
||||
expect(result.insight.summary).toBe("Spending is stable.");
|
||||
expect(result.insight.recommendations).toBe("Keep food spending under watch.");
|
||||
});
|
||||
|
||||
it("coerces array recommendations from the local model", async () => {
|
||||
const { db } = await import("@/lib/db");
|
||||
const { generateMonthlyInsight } = await import("@/lib/insights");
|
||||
|
||||
vi.mocked(db.expense.findMany).mockResolvedValue([
|
||||
{
|
||||
id: "expense-1",
|
||||
title: "Groceries",
|
||||
date: "2026-03-23",
|
||||
amountCents: 3200,
|
||||
category: "FOOD",
|
||||
createdAt: new Date("2026-03-23T10:00:00.000Z"),
|
||||
},
|
||||
{
|
||||
id: "expense-2",
|
||||
title: "Rent",
|
||||
date: "2026-03-02",
|
||||
amountCents: 120000,
|
||||
category: "RENT",
|
||||
createdAt: new Date("2026-03-02T10:00:00.000Z"),
|
||||
},
|
||||
]);
|
||||
vi.mocked(db.paycheck.findMany).mockResolvedValue([
|
||||
{
|
||||
id: "paycheck-1",
|
||||
payDate: "2026-03-01",
|
||||
amountCents: 180000,
|
||||
createdAt: new Date("2026-03-01T10:00:00.000Z"),
|
||||
},
|
||||
]);
|
||||
|
||||
vi.spyOn(globalThis, "fetch").mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
response: JSON.stringify({
|
||||
summary: "Spending remains manageable.",
|
||||
recommendations: ["Keep groceries planned.", "Move surplus to savings."],
|
||||
}),
|
||||
}),
|
||||
} as Response);
|
||||
|
||||
const result = await generateMonthlyInsight("2026-03");
|
||||
|
||||
expect(result.insight.recommendations).toContain("Keep groceries planned.");
|
||||
expect(result.insight.recommendations).toContain("Move surplus to savings.");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user