teqo/tests/unit
Francisco Ignácio Fontoura Solla 0a63621d4b B37 simplify: one membership delta, cap messages named once.
nextStateDeputyIdsAfterMunicipalityMembership was the third byte-for-byte copy
of the same single-id delta — nextAdvisorIdsAfterMembership and
nextStateDeputyIdsAfterMembership differ from it only in which cap they read —
so the algorithm now lives once in nextIdsAfterMembership with the cap as data,
and the three named wrappers just bind their own. The three cloned spec files
became one describe.each suite: coverage went up rather than down, since every
relation now gets the "can go to zero" and no-mutation cases only B37's clone
had, plus an explicit assertion that each wrapper refuses at ITS cap with ITS
message.

That pairing matters because mapCampaignFormActionError matches thrown messages
against safeMessages by exact string, and two of those cap messages were bare
literals in three src places each (thrown, plus two independent allowlists):
rewording any one would have silently collapsed a real refusal into "tente
novamente". Both are constants now, next to their caps, following the
MUNICIPALITY_STATE_DEPUTIES_CAP_MESSAGE precedent already in those same files.
The dobradinha staff message had the same exposure in four places — and
actions/stateDeputy.ts already imported the constant while restating it as a
literal one line below — so it is STATE_DEPUTY_STAFF_MESSAGE (renamed: it
guards create/update too, not just the batch), and the conflict message it
shares with the create route is named too.

The batch action stopped resolving the dobradinha slug before its loop: the
slug exists only to target the revalidate, which the caller already skips when
nothing changed, so on a no-op batch that read was fetched and thrown away —
the guard setLeadershipMunicipalitiesMembershipRecord already had. Its
redundant second dedup is gone (the schema's transform already deduped; the
sort stays, for deadlock-free lock ordering), and the bare 435 shared with the
advisor batch is MAX_MUNICIPALITIES_PER_BATCH.

Two memoization gaps closed, both restoring invariants the codebase had already
established elsewhere. An advisor's scoped .filter() returned a fresh array per
row, defeating the WeakMap that exists precisely to share derivations across
rows, so scopedPortfolioIndex memoizes on (index, addableIds) and every row
gets one array. And LeadershipStateDeputyRelationCell called matchesAtWordStart
per candidate, paying an NFD pass plus three Unicode regexes on both sides per
keystroke over the unpaginated leadership catalog — the cost wordStartFilter's
own doc comment warns about; it now normalizes the query once against labels
cached on options, like municipalityPortfolio.

Rejected with reason: maxItems on the dobradinhas cell. A dobradinha has no
product ceiling on municípios (that is why the bound is the catalog), so a
"generous 30" would invent a rule that refuses a legitimate statewide
dobradinha, and the honest 435 is unreachable when ids are unique.

Also dropped the dead addPlaceholder knob no caller ever set.
2026-07-28 10:25:47 -03:00
..
activityUi.unit.spec.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
advisorSchema.unit.spec.ts B19: Gerenciar assessores (/campanha/assessores) 2026-07-25 02:40:47 -03:00
bahiaElectionAggregates.unit.spec.ts B13: escala relativa no mapa dos Municipios (quantis/LQ/posicao) + artefato TSE v3 2026-07-26 04:22:56 -03:00
bahiaMapStyle.unit.spec.ts B8+: escala das malhas em unidades reais, contrato do map key e degradacao 2026-07-27 01:59:36 -03:00
campaignActionContext.unit.spec.ts B19: Gerenciar assessores (/campanha/assessores) 2026-07-25 02:40:47 -03:00
campaignAuthCookie.unit.spec.ts Add remembered campaign sessions 2026-07-27 08:57:26 -03:00
campaignAuthMemoization.unit.spec.ts Ship /campanha nuclei MVP with RBAC, invites, and vote estimates. 2026-07-18 15:01:56 -03:00
campaignCellAutosave.unit.spec.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignCellEditOverlay.unit.spec.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignColumnPicker.unit.spec.ts B17 simplify: inherit header labels, split persist from refresh. 2026-07-28 09:17:46 -03:00
campaignColumnVisibility.unit.spec.ts B17: column picker on the seven CampaignTable list surfaces. 2026-07-28 08:25:16 -03:00
campaignComponents.unit.spec.ts B17 simplify: inherit header labels, split persist from refresh. 2026-07-28 09:17:46 -03:00
campaignCompositionCleanup.unit.spec.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
campaignConsent.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignEntityListParsers.unit.spec.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
campaignFormActions.unit.spec.ts Pass 2 W4d: runCampaignFormAction (stay-on-page) fecha o C8 F4 2026-07-25 15:33:19 -03:00
campaignGeolocation.unit.spec.ts B14: municipio mais proximo (atalho geo no Inicio staff) 2026-07-26 17:33:33 -03:00
campaignIntelligenceConcepts.unit.spec.ts B22: explicacao por coluna no header das listas — description em CampaignTableHead/MunicipalitySortableHead, campaignConceptOneLiner como fonte unica E18, municipalityColumnDescriptions cobrindo as 11 colunas de /campanha/municipios 2026-07-26 02:58:54 -03:00
campaignInviteArchitecture.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignInviteInteractions.unit.spec.ts B30: convite WhatsApp na lista de lideranças 2026-07-26 20:47:11 -03:00
campaignInviteOrigin.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignJsonMutationRoute.unit.spec.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignListFilterNavigation.unit.spec.ts B33+: close the /simplify rounds on the shared list filter hook 2026-07-27 09:39:15 -03:00
campaignListUrl.unit.spec.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
campaignLoginAction.unit.spec.ts Add remembered campaign sessions 2026-07-27 08:57:26 -03:00
campaignMigrationSafety.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignPasswordSchemas.unit.spec.ts Add campaign password reset, profile photo, and RS+ follow-up plan. 2026-07-19 05:26:56 -03:00
campaignPwa.unit.spec.ts Add installable PWA foundation for the /campanha field app. 2026-07-18 17:28:34 -03:00
campaignSearchInput.unit.spec.ts Pass 2 W2: components/campaign em subpastas por dominio 2026-07-25 14:52:17 -03:00
campaignTable.unit.spec.ts B17: column picker on the seven CampaignTable list surfaces. 2026-07-28 08:25:16 -03:00
campaignUserProfile.unit.spec.ts Add the tooling gate: knip, CI, zero-warning lint, as-never ban 2026-07-23 23:06:12 -03:00
campoParties.unit.spec.ts E8: Conta da cadeira (metas derivadas, potencial por município, cobertura) 2026-07-24 22:54:27 -03:00
choroplethPercentScale.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
codebaseConventions.unit.spec.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
contactCityMigration.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
dashboardPriorityMunicipalities.unit.spec.ts B20: municípios prioritários no Início com déficit E9 e CTA para a lista. 2026-07-25 20:01:51 -03:00
electionPartySpectrum.unit.spec.ts Pass 2 W4a: electionInsights.ts deletado (941 linhas, 71 exports, 2 vivos) 2026-07-25 14:57:49 -03:00
electionResults.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
engagementLevel.unit.spec.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
facebookPixel.unit.spec.ts Add Meta Pixel tracking to public petition pages. 2026-07-21 10:51:47 -03:00
formatRelativeAge.unit.spec.ts Polish /campanha Field Desk UX and register FD+/FD2 follow-ups. 2026-07-19 08:17:12 -03:00
goalCoverage.unit.spec.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
leadershipListUrl.unit.spec.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
leadershipMunicipalityMembership.unit.spec.ts B34: editable município chips on the leaderships list. 2026-07-27 22:35:19 -03:00
leadershipStateDeputyRelationCell.unit.spec.ts Deliver B37: editable município chips on the dobradinhas list. 2026-07-28 09:34:39 -03:00
mapScaleClasses.unit.spec.ts simplify(B13): corrige classe agregada, bolhas em pane proprio e registra debitos 2026-07-26 05:12:37 -03:00
municipalityGeographyParts.unit.spec.ts B25: link do território na lista de municípios 2026-07-26 18:59:49 -03:00
municipalityList.unit.spec.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
municipalityMapNavigation.unit.spec.ts B8+: escala das malhas em unidades reais, contrato do map key e degradacao 2026-07-27 01:59:36 -03:00
municipalityPortfolio.unit.spec.ts B34: editable município chips on the leaderships list. 2026-07-27 22:35:19 -03:00
municipalityPortfolioCell.unit.spec.ts Adopt B42's cell-edit overlay in B34 and fix the optimistic baseline again. 2026-07-27 23:59:20 -03:00
municipalityPotential.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
municipalityProximity.unit.spec.ts simplify(B14): corrige o mecanismo da fronteira, estado unsupported e duplicatas 2026-07-26 18:03:44 -03:00
municipalityStaffVoteTotal.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
municipalityTerritorialClass.unit.spec.ts simplify(B13): corrige classe agregada, bolhas em pane proprio e registra debitos 2026-07-26 05:12:37 -03:00
municipalityVoteRank.unit.spec.ts simplify(B13): corrige classe agregada, bolhas em pane proprio e registra debitos 2026-07-26 05:12:37 -03:00
onda0ConsentTexts.unit.spec.ts Add pre-push typecheck hook and fix campaign avatar field access. 2026-07-19 12:10:59 -03:00
payloadAdminRoles.unit.spec.ts Add users.roles so Payload /admin can separate editors from admins. 2026-07-27 01:54:29 -03:00
projectionSheetParse.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
recentVisits.unit.spec.ts C13 pos-simplify: fecha os residuos da varredura e estreita os guards 2026-07-25 21:29:32 -03:00
relationMembershipDelta.unit.spec.ts B37 simplify: one membership delta, cap messages named once. 2026-07-28 10:25:47 -03:00
revalidateRequest.unit.spec.ts Add allowlisted global cache revalidation for Onda 0 F1. 2026-07-19 22:21:16 -03:00
signatureExport.unit.spec.ts Add admin CSV export for signatures and contacts. 2026-07-23 00:53:04 -03:00
siteMetadata.unit.spec.ts Make public SEO resilient when the metadata global is empty. 2026-07-27 08:20:33 -03:00
stateDeputyListUrl.unit.spec.ts B33: ordenação e filtro no header da lista de dobradinhas 2026-07-26 16:21:40 -03:00
supporterSchema.unit.spec.ts Add C6 scale/DRY for supporters: bulk import, KPI aggregate, shared shells. 2026-07-18 22:17:31 -03:00
supporterUi.unit.spec.ts Pass 2 W0: pina contratos de URL e loaders das listas + truth-up TESTING/TECH-DEBT 2026-07-25 13:30:39 -03:00
territoryAnchor.unit.spec.ts B25: link do território na lista de municípios 2026-07-26 18:59:49 -03:00
territoryListUrl.unit.spec.ts B21: cria página própria dos territórios 2026-07-25 21:50:24 -03:00
territoryOverview.unit.spec.ts E12: camada TI com rollups MAUP e benchmark intra-TI. 2026-07-26 21:26:47 -03:00
visitEligibility.unit.spec.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
voteEstimate.unit.spec.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
voteTrend.unit.spec.ts Pass 2 W4a: electionInsights.ts deletado (941 linhas, 71 exports, 2 vivos) 2026-07-25 14:57:49 -03:00