- Substitui loadActivityOptions (pagination: false) por AsyncSearchCombobox com busca server-backed filtrada por município (searchActivityRelationOptions). - Pagina card Demandas vinculadas no detalhe da atividade (10/página) com soma de custo em query separada e link Ver todas na lista filtrada. - Adiciona filtro ?activity= na lista /campanha/demandas. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
ACTIVITY_RELATION_SEARCH_LIMIT,
|
|
searchActivityRelationOptions,
|
|
} from '@/utilities/activityRelationOptions'
|
|
import { ACTIVITY_LINKED_DEMANDS_PAGE_SIZE } from '@/utilities/activityDetailPageData'
|
|
import { parseDemandListParams } from '@/utilities/campaignDemandData'
|
|
|
|
describe('activityRelationOptions', () => {
|
|
it('returns no options without a municipality scope', async () => {
|
|
const payload = { find: async () => ({ docs: [] }) }
|
|
await expect(
|
|
searchActivityRelationOptions(payload, { id: 1 } as never, 'caminhada', null),
|
|
).resolves.toEqual([])
|
|
})
|
|
|
|
it('caps search results at the configured limit', () => {
|
|
expect(ACTIVITY_RELATION_SEARCH_LIMIT).toBe(20)
|
|
})
|
|
})
|
|
|
|
describe('activity linked demands scale (C11)', () => {
|
|
it('uses a bounded page size for overview cards', () => {
|
|
expect(ACTIVITY_LINKED_DEMANDS_PAGE_SIZE).toBe(10)
|
|
})
|
|
|
|
it('parses activity filter on the demand list', () => {
|
|
expect(parseDemandListParams({ activity: '42', page: '2' })).toEqual({
|
|
page: 2,
|
|
activityId: 42,
|
|
})
|
|
})
|
|
})
|