mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
- HybridPledgeEstimateForm lê valores de votePledgesCollection (não props RSC) - Outbox faz patch optimista no mirror e aplica write do servidor com estimatedAt - Helpers read/subscribe/patch no opsMirrorClient + mapper mapVotePledgeWriteToOps - Testes unitários para merge protegido, patch optimista e mapper de write Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { mapVotePledgeWriteToOps } from '@/lib/campaignOps/mapVotePledgeWriteToOps'
|
|
|
|
describe('mapVotePledgeWriteToOps (OH7)', () => {
|
|
it('maps a depth-0 write response into an OpsVotePledge row', () => {
|
|
expect(
|
|
mapVotePledgeWriteToOps({
|
|
id: 10,
|
|
leadership: 2,
|
|
municipality: 1,
|
|
declaredVotes: 120,
|
|
declaredAt: '2026-08-01T10:00:00.000Z',
|
|
declaredBy: 5,
|
|
updatedAt: '2026-08-01T13:00:00.000Z',
|
|
estimatedVotes: { pessimistic: 80, central: 100, optimistic: 120 },
|
|
estimateNote: 'nota',
|
|
estimatedBy: 5,
|
|
estimatedAt: '2026-08-01T13:00:00.000Z',
|
|
}),
|
|
).toEqual({
|
|
id: 10,
|
|
leadership: 2,
|
|
municipality: 1,
|
|
declaredVotes: 120,
|
|
declaredAt: '2026-08-01T10:00:00.000Z',
|
|
declaredBy: 5,
|
|
updatedAt: '2026-08-01T13:00:00.000Z',
|
|
estimatedVotes: { pessimistic: 80, central: 100, optimistic: 120 },
|
|
estimateNote: 'nota',
|
|
estimatedBy: 5,
|
|
estimatedAt: '2026-08-01T13:00:00.000Z',
|
|
})
|
|
})
|
|
})
|