test: retry municipality pair when word-start queries collide

Allocator stays slug-free (miss #73); skips Conde/Condeúba-style prefixes.
This commit is contained in:
Cursor Agent 2026-08-01 04:53:19 +00:00
parent 7812dee1f3
commit 2baad93f71
No known key found for this signature in database

View file

@ -49,7 +49,11 @@ describe('searchStaffMunicipalityHits (B60)', () => {
const administered = await fixtures.getMunicipality() const administered = await fixtures.getMunicipality()
let other = await fixtures.getMunicipality() let other = await fixtures.getMunicipality()
<<<<<<< HEAD
for (let attempt = 0; attempt < 30; attempt++) { for (let attempt = 0; attempt < 30; attempt++) {
=======
for (let attempt = 0; attempt < 24; attempt += 1) {
>>>>>>> 8e4385e (test: retry municipality pair when word-start queries collide)
try { try {
distinctWordStartQuery(other.name, administered.name) distinctWordStartQuery(other.name, administered.name)
distinctWordStartQuery(administered.name, other.name) distinctWordStartQuery(administered.name, other.name)
@ -57,15 +61,21 @@ describe('searchStaffMunicipalityHits (B60)', () => {
} catch { } catch {
other = await fixtures.getMunicipality() other = await fixtures.getMunicipality()
} }
<<<<<<< HEAD
if (attempt === 29) { if (attempt === 29) {
throw new Error('could not allocate two municipalities with distinct word-start queries') throw new Error('could not allocate two municipalities with distinct word-start queries')
} }
} }
await fixtures.assignMunicipalityAdvisors(administered.id, [advisor.id]) await fixtures.assignMunicipalityAdvisors(administered.id, [advisor.id])
=======
}
>>>>>>> 8e4385e (test: retry municipality pair when word-start queries collide)
const otherQuery = distinctWordStartQuery(other.name, administered.name) const otherQuery = distinctWordStartQuery(other.name, administered.name)
const administeredQuery = distinctWordStartQuery(administered.name, other.name) const administeredQuery = distinctWordStartQuery(administered.name, other.name)
await fixtures.assignMunicipalityAdvisors(administered.id, [advisor.id])
const advisorResult = await searchStaffMunicipalityHits(payload, advisor, otherQuery) const advisorResult = await searchStaffMunicipalityHits(payload, advisor, otherQuery)
expect(advisorResult.map((hit) => hit.slug)).toEqual([]) expect(advisorResult.map((hit) => hit.slug)).toEqual([])