test(mood): align integration fixtures with the curated default catalog

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.
This commit is contained in:
Marc-André Bombeck committed 2026-06-14 11:31:52 +02:00
1 parent 5aefcd59eb
commit 4c1c3f70e2
2 files changed
+11 -11

No files matched your search

+4 -4
View File
@@ -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 }],
},
],
}),
+7 -7
View File
@@ -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<string, string[]> };
};
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 () => {