From 4c1c3f70e264d318c6af2c4c3928ea5a4635ecf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 14 Jun 2026 11:31:52 +0200 Subject: [PATCH] test(mood): align integration fixtures with the curated default catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.16.13 catalog curation deactivated the default tags happy, excited, hydrated, music and the factor_sleep_quality RATED factor. Integration tests that run the real migrations against testcontainers Postgres still hard-coded the pre-curation catalog and failed. Swap the placeable built-in tag from happy to grateful (a long-standing active feelings tag) and the seeded RATED factor from factor_sleep_quality to factor_sadness (still active, same 1..5 inverse scale). Assertions and intent are unchanged — only the fixtures move onto the live catalog. --- tests/integration/mood-entries-bulk.test.ts | 8 ++++---- tests/integration/mood-tag-groups.test.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/integration/mood-entries-bulk.test.ts b/tests/integration/mood-entries-bulk.test.ts index c595c8566..388e1531f 100644 --- a/tests/integration/mood-entries-bulk.test.ts +++ b/tests/integration/mood-entries-bulk.test.ts @@ -195,7 +195,7 @@ describe("POST /api/mood-entries/bulk (real Postgres)", () => { moodLoggedAt: "2026-05-16T08:00:00.000Z", ratedFactors: [ { key: "factor_work", rating: 4 }, - { key: "factor_sleep_quality", rating: 2 }, + { key: "factor_sadness", rating: 2 }, ], }, ], @@ -220,7 +220,7 @@ describe("POST /api/mood-entries/bulk (real Postgres)", () => { rating: l.rating, })), ).toEqual([ - { key: "factor_sleep_quality", kind: "RATED", rating: 2 }, + { key: "factor_sadness", kind: "RATED", rating: 2 }, { key: "factor_work", kind: "RATED", rating: 4 }, ]); }); @@ -239,8 +239,8 @@ describe("POST /api/mood-entries/bulk (real Postgres)", () => { { mood: "GUT", moodLoggedAt: "2026-05-16T08:00:00.000Z", - // factor_sleep_quality scale is 1..5; rating 9 is out of range. - ratedFactors: [{ key: "factor_sleep_quality", rating: 9 }], + // factor_sadness scale is 1..5; rating 9 is out of range. + ratedFactors: [{ key: "factor_sadness", rating: 9 }], }, ], }), diff --git a/tests/integration/mood-tag-groups.test.ts b/tests/integration/mood-tag-groups.test.ts index 936dcb65d..21a7aba2c 100644 --- a/tests/integration/mood-tag-groups.test.ts +++ b/tests/integration/mood-tag-groups.test.ts @@ -210,7 +210,7 @@ describe("custom mood-tag groups (real Postgres)", () => { const layoutRes = await putLayout( jsonReq("http://localhost/api/mood/tags/layout", "PUT", { groupOrder: [groupKey, "feelings"], - placements: { [groupKey]: ["happy"] }, + placements: { [groupKey]: ["grateful"] }, }), ); expect(layoutRes.status).toBe(200); @@ -270,7 +270,7 @@ describe("custom mood-tag groups (real Postgres)", () => { // 1st PUT: placements only. await putLayout( jsonReq("http://localhost/api/mood/tags/layout", "PUT", { - placements: { [groupKey]: ["happy"] }, + placements: { [groupKey]: ["grateful"] }, }), ); // 2nd PUT: groupOrder only — must keep the stored placements. @@ -284,18 +284,18 @@ describe("custom mood-tag groups (real Postgres)", () => { data: { groupOrder: string[]; placements: Record }; }; expect(layout.data.groupOrder[0]).toBe(groupKey); - expect(layout.data.placements).toEqual({ [groupKey]: ["happy"] }); + expect(layout.data.placements).toEqual({ [groupKey]: ["grateful"] }); // The effective tree leads with the group and carries the placed // catalogue tag inside it (placement, not a categoryId change). const tree = await readTree(); expect(tree[0].key).toBe(groupKey); - expect(tree[0].tags.map((t) => t.key)).toContain("happy"); - const happyRow = await getPrismaClient().moodTag.findUnique({ - where: { key: "happy" }, + expect(tree[0].tags.map((t) => t.key)).toContain("grateful"); + const gratefulRow = await getPrismaClient().moodTag.findUnique({ + where: { key: "grateful" }, select: { category: { select: { key: true } } }, }); - expect(happyRow?.category.key).not.toBe(groupKey); + expect(gratefulRow?.category.key).not.toBe(groupKey); }); it("include=archived surfaces an archived custom tag for restore", async () => {