test(concurrency): cover the prefs guards, the inventory lock, and the privacy re-check

Add interleaved-writer, tokenless-compat, and malformed-token coverage for the
notification-prefs, modules, coach-prefs, and mood-tag-layout write guards,
including the notification-prefs case where a stale web write must not revert
the app-managed medication flag. Pin the inventory PATCH and DELETE routing
through the advisory lock, and cover the insight-generation privacy re-check on
both the main commit and the reroll arm.
This commit is contained in:
Marc-André Bombeck committed 2026-07-24 18:08:01 +02:00
1 parent 3f33a30415
commit f9afa794e9
16 files changed
+959 -11

No files matched your search

@@ -38,7 +38,14 @@ const mutateSpy = vi.fn();
const invalidateSpy = vi.fn();
vi.mock("@tanstack/react-query", () => ({
useQueryClient: () => ({ invalidateQueries: invalidateSpy }),
useQueryClient: () => ({
invalidateQueries: invalidateSpy,
// v1.32.22 (M3) — the writer reads/seeds the optimistic-concurrency token
// via the query cache; no token seeded → tokenless (unconditional) write.
getQueryData: () => undefined,
setQueryData: vi.fn(),
removeQueries: vi.fn(),
}),
useMutation: (config: MutationConfig) => {
lastMutation = config;
return { mutate: mutateSpy, isPending: false };