mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
feat(insights): persist correlation patterns
This commit is contained in:
1 parent
8ece6f39cc
commit
666a85d311
53 files changed
+2129
-55
No files matched your search
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user