feat(insights): persist correlation patterns

This commit is contained in:
Marc-André Bombeck committed 2026-07-28 14:01:11 +02:00
1 parent 8ece6f39cc
commit 666a85d311
53 files changed
+2129 -55

No files matched your search

+24
View File
@@ -130,6 +130,30 @@ beforeEach(async () => {
});
describe("custom mood-tag groups (real Postgres)", () => {
it("exposes alcohol, caffeine, and nicotine from the built-in binary catalogue", async () => {
await actAs(USER_A, "mtg-a");
const tree = await readTree();
const health = tree.find((category) => category.key === "health");
expect(health).toBeDefined();
expect(
health!.tags
.filter((tag) => ["alcohol", "caffeine", "nicotine"].includes(tag.key))
.map((tag) => tag.key)
.sort(),
).toEqual(["alcohol", "caffeine", "nicotine"]);
const rows = await getPrismaClient().moodTag.findMany({
where: { key: { in: ["alcohol", "caffeine", "nicotine"] } },
select: { key: true, userId: true, kind: true, isActive: true },
orderBy: { key: "asc" },
});
expect(rows).toEqual([
{ key: "alcohol", userId: null, kind: "BINARY", isActive: true },
{ key: "caffeine", userId: null, kind: "BINARY", isActive: true },
{ key: "nicotine", userId: null, kind: "BINARY", isActive: true },
]);
});
it("creates a group, stores the label encrypted, and resolves it on the management read", async () => {
await actAs(USER_A, "mtg-a");
const groupKey = await createGroup("Therapie", "Stethoscope");