teqo-backup/tests/unit/activityHybridUpdatePayload.unit.spec.ts
Cursor Agent 1011eaafd2
fix(activity): hybrid edit hides unsavable fields and clears relations
Offline/hybrid activity updates no longer render tasks/demands editors
(outbox cannot persist them) and always send null when responsible or
leadership is cleared.
2026-08-02 06:39:58 +00:00

25 lines
771 B
TypeScript

import { describe, expect, it } from 'vitest'
import { activityUpdateSchema } from '@/lib/schemas/activity'
/**
* Pass 5 P1a — hybrid activity updates must be able to clear relations with
* explicit null (omitting the key leaves the previous server value).
*/
describe('activity hybrid update payload (Pass 5 P1a)', () => {
it('accepts null responsible and leadership on patch', () => {
const parsed = activityUpdateSchema.parse({
id: 1,
responsible: null,
leadership: null,
description: null,
locality: null,
})
expect(parsed.responsible).toBeNull()
expect(parsed.leadership).toBeNull()
})
it('rejects omitting id', () => {
expect(() => activityUpdateSchema.parse({ responsible: null })).toThrow()
})
})